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: Bernhard Voelker
Subject: bug#12366: [gnu-prog-discuss] Writing unwritable files
Date: Thu, 6 Sep 2012 14:43:59 +0200 (CEST)



On September 6, 2012 at 2:12 PM Paolo Bonzini <address@hidden> wrote:

> [For bug-coreutils: the context here is that sed -i, just like perl -i,
> breaks hard links and thus destroys the content of files with 0400
> permission].

I consider this being 2 different cases:

* 'sed -i' breaks hard links:
That's because it places the output at place where
the input file was (by unlink+rename).
That's okay IMO.

* 'sed -i' destroys the content of files with 0400 perms:
That's a bug IMHO. sed should open the input file read-write.
If that fails, then the input won't change with a nice diagnostic.

In 'sort -o', we recently added a similar check right at the beginning
to avoid useless processing possibly leading to an error afterwards:
see http://bugs.gnu.org/11816 with the commit
http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=44fbd3fd862e34d42006f8b74cb11c9c56346417
<http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=44fbd3fd862e34d42006f8b74cb11c9c56346417>

Have a nice day,
Berny





reply via email to

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