[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add new option --in-place
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] Add new option --in-place |
Date: |
Thu, 25 Mar 2010 11:30:45 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
On 24/03/10 12:15, Pádraig Brady wrote:
> Also I noticed that `mv -b ./file.tmp ./file` is not atomic
> because the renames are done like: rename(file,bak); rename(tmp,file);
I summarized the issues involved with replacing files and it was surprisingly
popular:
http://www.reddit.com/r/programming/comments/bhnab/replacing_a_file_on_unix_is_hard/
It was indirectly suggested there to use hardlinks for atomic backups,
which I've amended the attached script to do. Other changes include
falling back to cp -a if --attributes-only is not supported, and
correctly removing all temp files.
I wonder should `mv -b` (and sed -i) use the ln method to
try to be atomic and then fall back to the double rename?
I'll look into it at some stage.
cheers,
Pádraig.
rp
Description: Text document
- Re: [PATCH] Add new option --in-place, (continued)
- Re: [PATCH] Add new option --in-place, Pádraig Brady, 2010/03/20
- Re: [PATCH] Add new option --in-place, Jim Meyering, 2010/03/21
- Re: [PATCH] Add new option --in-place, Pádraig Brady, 2010/03/21
- Re: [PATCH] Add new option --in-place, Pádraig Brady, 2010/03/22
- Re: [PATCH] Add new option --in-place, Pádraig Brady, 2010/03/22
- Re: [PATCH] Add new option --in-place, Eric Blake, 2010/03/22
- Re: [PATCH] Add new option --in-place, Pádraig Brady, 2010/03/22
- Re: [PATCH] Add new option --in-place, Jim Meyering, 2010/03/23
- Re: [PATCH] Add new option --in-place, Pádraig Brady, 2010/03/23
- Re: [PATCH] Add new option --in-place, Pádraig Brady, 2010/03/24
- Re: [PATCH] Add new option --in-place,
Pádraig Brady <=