bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12366: [gnu-prog-discuss] Writing unwritable files


From: Paul Eggert
Subject: bug#12366: [gnu-prog-discuss] Writing unwritable files
Date: Thu, 06 Sep 2012 09:11:52 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/06/2012 05:12 AM, Paolo Bonzini wrote:
> I consider "shuf foo -o foo" (on a read-write file) to be insecure.
> Besides, it works by chance

It's not by chance.  shuf is designed to let you
shuffle a file in-place, and is documented to work,
by analogy with "sort -o foo foo".  If we ever
change "shuf" to use mmap, we'll make
sure it continues to work in-place.

I'm not sure what is meant by "insecure" here.
Of course there are race conditions if other
processes modify a file when "shuf"
reads or writes it, but that's true for pretty
much any program that reads or writes any file,
including sed -i.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]