|
From: | Assaf Gordon |
Subject: | bug#49287: sed -i disrespects read-only |
Date: | Wed, 4 Aug 2021 15:17:50 -0600 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 |
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@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
[Prev in Thread] | Current Thread | [Next in Thread] |