[Top][All Lists]
[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 19:35:29 +0200 (CEST) |
On September 6, 2012 at 7:23 PM Paul Eggert <address@hidden> wrote:
> On 09/06/2012 10:12 AM, Bob Proulx wrote:
> > The file replacement is atomic. The reading of the file is not.
>
> Sure, but the point is that from the end user's
> point of view, 'sed -i' is not atomic, and can't
> be expected to be atomic.
>
> 'sed -i' and 'sort -o' both use some atomic operations
> internally, but neither is atomic overall. Users who
> want atomicity must look elsewhere, or implement it
> themselves.
Why can't 'sed -i' be made atomic for the user?
Today, it creates a temporary file for the output.
At the end, it calls rename(). What if it instead
rewinds the input and that temporary file and copies
it's content to the input file?
Okay, this is slower than a rename(), but it would
write into the same inode. To preserve today's behaviour,
this could be done with a new option like --in-place-same.
Just a thought.
Have a nice day,
Berny
- bug#12366: [gnu-prog-discuss] Writing unwritable files, (continued)
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Bernhard Voelker, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Jim Meyering, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Paul Eggert, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Paolo Bonzini, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Paul Eggert, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Paolo Bonzini, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Paul Eggert, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Bob Proulx, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Paul Eggert, 2012/09/06
- bug#12366: [gnu-prog-discuss] Writing unwritable files,
Bernhard Voelker <=
- bug#12366: [gnu-prog-discuss] Writing unwritable files, Paul Eggert, 2012/09/06
- bug#12366: [gnu-prog-discuss] bug#12366: Writing unwritable files, John Darrington, 2012/09/06
- bug#12366: [gnu-prog-discuss] bug#12366: Writing unwritable files, Paolo Bonzini, 2012/09/07
- bug#12366: [gnu-prog-discuss] bug#12366: Writing unwritable files, Paul Eggert, 2012/09/07
- bug#12366: [gnu-prog-discuss] bug#12366: Writing unwritable files, Bob Proulx, 2012/09/07
- bug#12366: [gnu-prog-discuss] bug#12366: Writing unwritable files, Bob Friesenhahn, 2012/09/06
- bug#12366: [gnu-prog-discuss] bug#12366: Writing unwritable files, Paolo Bonzini, 2012/09/06