Re: [PATCH] fixup! use perl instead of sed
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- May 9, 2017, 21:08 UTC
- Message-ID
- <CACBZZX6T6f_XzqgAM8RO7sNsUy+0Qsawdaha7B4BtADt5fJszQ@mail.gmail.com>
- In-Reply-To
- <4cb1d101-3efa-6376-64fd-2b9090d0b0c4@kdbg.org>
On Tue, May 9, 2017 at 10:43 PM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 9 quoted lines
> Am 09.05.2017 um 19:00 schrieb Ævar Arnfjörð Bjarmason: >> >> Finally, you can just use -i like you did with sed, no need for the >> tempfile: > > > Nope. Some implementations of perl attempt to remove the file that it has > just opened. That doesn't work on Windows. You have to supply a backup file > name as in `perl -i.bak ...` :-(
This should have been fixed in 2002, and is in 5.8, the oldest perl release we support: https://github.com/Perl/perl5/commit/c030f24b81 & http://www.nntp.perl.org/group/perl.perl5.porters/2002/05/msg60275.html
But maybe __CYGWIN__ isn't always defined on Windows, maybe this was a mingw build or something and perl was missing a test for this when support for that was added?
This is obviously a trivial issue for git, but if it's a bug in perl I'd like to fix that.
Show 8 quoted lines
>> >> $ echo hibar >push >> $ perl -pi -e 's/([^ ])bar/$1baz/' push >> $ cat push >> hibaz > > > -- Hannes