[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: save-buffer: avoid data loss on interrupt

From: Paul Eggert
Subject: Re: save-buffer: avoid data loss on interrupt
Date: Tue, 13 Dec 2011 13:47:00 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

On 12/13/11 12:52, Jim Meyering wrote:
> doesn't this deserve to be enabled more often
> than when someone tweaks the break-hardlink-on-save variable?

I'd like to do that too, but things are a bit tricky here.
For example, what if the file has a special ACL?
Won't that get lost?

> How about this instead, assuming a file-owner-uid function?
> (or if the two users of file-attributes is an issue,
> we could combine file-nlinks and file-owner-uid into
> a function that calls file-attributes just once)
> Sure, this might still change the group, but if that's an issue
> we could compare it to the default group.

Unfortunately one can't predict the ownership of the new file
so easily.  It might be a setuid directory; on some hosts,
that causes new files in the directory to have the same
owner as the directory.

A more reliable way to deal with it might be to create the
temporary file, and ensure that its owner and group
and any other special attributes are correct, before copying to it.
Normally the check should succeed, so this shouldn't cost much
on the average.  The permissions should be conservative
(e.g., original permissions sans executable bits) until the
copying is done.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]