develooper Front page | perl.perl5.porters | Postings from December 2008

Re: [perl #60904] [PATCH] Race condition with perl -i.bk

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
December 13, 2008 06:01
Subject:
Re: [perl #60904] [PATCH] Race condition with perl -i.bk
Message ID:
b77c1dce0812130601v47046baes8250f6c0a9321657@mail.gmail.com
2008/12/13 Chip Salzenberg <chip@pobox.com>:
> On Mon, Dec 01, 2008 at 03:01:12PM -0800, Chip Salzenberg wrote:
>> On Fri, Nov 28, 2008 at 09:18:31AM -0800, skasal@redhat.com (via RT) wrote:
>> > when I call "perl -pi.bk -e 's/x/y/' foo, thge strace log contains this:
>> >   rename("foo", "foo.bk") = 0
>> >   open("foo", ..., 0666)  = 4
>> >   ...
>> >   fchmod(4, 0100600)      = 0
>> > This means that the new file is created using the final filename "foo"
>> > (which is predictable) and with mode 666 (modulo umask), which means
>> > the file is group or even world writable.
>> >
>> > I'd suggest changing that mode to "0600" or "0400".
>>
>> It's a fair cop, but society's to blame.
>> Here's a patch, which not only fixes the bug by using mode 0600, but also
>> removes tests of PL_inplace in places where it has already been tested.
>
> The patch below was not applied.  Is something wrong with it, or did it
> perhaps just get overlooked?

I'm catching up from a few days without much internet.
Thanks, applied as #35082.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About