bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sed -i should require write access (was: Bug in sed)


From: Paolo Bonzini
Subject: Re: sed -i should require write access (was: Bug in sed)
Date: Tue, 28 Dec 2010 22:13:21 +0100

On Tue, Dec 28, 2010 at 18:53, Paul Eggert <address@hidden> wrote:
> On 12/28/2010 08:55 AM, Bob Proulx wrote:
>> That is the way Unix filesystem permissions work.
>
> Yes, but still, it's bogus that "sed -i" overwrites a
> read-only file.  That's not what users expect, and it's
> not what the documentation says.  The documentation
> says that -i "overwrites the file in place", which implies
> that you must have write access to the file.
>
> How about the following patch, to fix this?

The patch is very elegant, but the behavior is documented in the
"Non-bugs" section of the info manual and is consistent with both perl
and BSD sed.  Also, I believe that changing it while keeping sed's
link-breaking behavior (which is only doable by copying the new
content over the old file, i.e. not atomically) is a worse
inconsistency.

Paolo



reply via email to

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