GNU bug report logs - #49287
sed -i disrespects read-only

Previous Next

Package: sed;

Reported by: Leonid Mironov <lvm <at> royal.net>

Date: Wed, 30 Jun 2021 08:31:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Davide Brini <dave_br <at> gmx.com>, 49287 <at> debbugs.gnu.org, Leonid Mironov <lvm <at> royal.net>
Subject: bug#49287: sed -i disrespects read-only
Date: Wed, 4 Aug 2021 15:17:50 -0600
tag 49287 notabug
close 49287
stop

Hello,

On 2021-07-01 7:22 a.m., Davide Brini wrote:
> On Wed, 30 Jun 2021 08:01:13 +0200, Leonid Mironov <lvm <at> royal.net> wrote:
> 
>>     sed disrespects read-only file attributes when editing in place.
>>
> 
> Well tecnically this is correct since sed never writes to the
> original file, instead it creates a new file, writes to it and finally
> renames it to the old name, so the original file permissions never come
> into play (in case you're wondering: it's not really "in-place").
> 
> I agree it could be surprising, but once you know how it works behind
> the scenes it should make a bit more sense.
> 

Thank you Davide for answering.

I would like to emphasize that this should *not* be surprising,
as it the way UNIX file and directory permissions have always worked -
this has nothing to do with sed.

Please see similar (and more detailed) discussion about it here:
  https://lists.gnu.org/archive/html/bug-sed/2017-06/msg00000.html

Please see here for in-depth examples of how "in-place" is not so trivial:
  http://www.pixelbeat.org/docs/unix_file_replacement.html



regards,
 -assaf




This bug report was last modified 4 years and 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.