Re: Safe File Update (atomic)
On Thu, Dec 30, 2010 at 7:20 PM, Shachar Shemesh <email@example.com> wrote:
>> Depending on /proc is probably not reasonable.
>> Are you sure it will be atomic? ;)
> open old file, get fd (we'll assume it's 5). Do readlink on /proc/self/fd/5,
> and get file's real path. Do everything in said path. It's atomic, in the
> sense that the determining point in time is the point in which you opened
> the old file.
>> How do you preserve owner (as non-root)?
> I thought I answered that. Best effort. You perform the chown, but do not
> bother with the return code. If it succeeded, great. If not, well, you did
> your best.
Ah. Another regression.
>> The reason I asked for a kernelland solution is because it's hard if
>> not impossible to do properly in userland. But some kernel devs (Ted
>> and others) don't agree. They reason that the desire to preserve all
>> meta-data isn't reasonable by itself.
> I'm with Henrique on that one. I am more concerned with the amount of
> non-Posix code that needs to go into this than preserving all attributes.
With kernel support you would only need a single non-POSIX flag.
Please be sure to document all assumptions / limitations of your variant.