[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] bootstrap: add bootstrap_sync option.
From: |
Paul Eggert |
Subject: |
Re: [PATCH] bootstrap: add bootstrap_sync option. |
Date: |
Mon, 15 Nov 2010 10:30:55 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 |
On 11/15/10 04:24, Pádraig Brady wrote:
> I've done it before, but I don't know how general the method is:
> http://www.pixelbeat.org/scripts/self_modify.sh
One problem I forsee is that, if the script is modified in place,
the modification can occur while the shell is reading the script.
So one must first create the desired script as a separate file,
and then atomically rename it over the original, so that the shell
can continue to access the original script as needed via its
already-open file descriptor. Even here, though,
I worry that POSIX does not say that a shell must open a script and
then access it only via a file descriptor: as far as I
can see, it's valid (though admittedly weird) for a shell to reopen
its script as needed, in which case the atomic-rename approach is
not reliable either. These sorts of race conditions are unlikely to be
a problem in practice, but failures will be weird and hard to
diagnose.
Also, suppose 'bootstrap' is a symlink to some other file,
for whatever reason: do we replace the symlink with a regular file,
or update the pointed-at file?
None of these objections are fatal, but still....
- Re: [PATCH] bootstrap: add bootstrap_sync option., Joel E. Denny, 2010/11/14
- Re: [PATCH] bootstrap: add bootstrap_sync option., Paul Eggert, 2010/11/15
- Re: [PATCH] bootstrap: add bootstrap_sync option., Pádraig Brady, 2010/11/15
- Re: [PATCH] bootstrap: add bootstrap_sync option.,
Paul Eggert <=
- Re: [PATCH] bootstrap: add bootstrap_sync option., Ralf Wildenhues, 2010/11/15
- Re: [PATCH] bootstrap: add bootstrap_sync option., Paolo Bonzini, 2010/11/17
- Re: [PATCH] bootstrap: add bootstrap_sync option., Ralf Wildenhues, 2010/11/17
- Re: [PATCH] bootstrap: add bootstrap_sync option., Joel E. Denny, 2010/11/19
- Re: [PATCH] bootstrap: add bootstrap_sync option., Ralf Wildenhues, 2010/11/20
- Re: [PATCH] bootstrap: add bootstrap_sync option., Joel E. Denny, 2010/11/20
- Re: [PATCH] bootstrap: add bootstrap_sync option., Ralf Wildenhues, 2010/11/20
- Re: [PATCH] bootstrap: add bootstrap_sync option., Joel E. Denny, 2010/11/20
- Re: [PATCH] bootstrap: add bootstrap_sync option., Jim Meyering, 2010/11/20
- Re: [PATCH] bootstrap: add bootstrap_sync option., Joel E. Denny, 2010/11/21