unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Jim Meyering <jim@meyering.net>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: save-buffer: avoid data loss on interrupt
Date: Tue, 13 Dec 2011 13:47:00 -0800	[thread overview]
Message-ID: <4EE7C7D4.8050206@cs.ucla.edu> (raw)
In-Reply-To: <87d3bsqjmm.fsf@rho.meyering.net>

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	other threads:[~2011-12-13 21:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 10:26 enabling atomic-update more often, i.e., rewrite via rename Jim Meyering
2011-12-13 17:13 ` save-buffer: avoid data loss on interrupt Jim Meyering
2011-12-13 20:03   ` Paul Eggert
2011-12-13 20:52     ` Jim Meyering
2011-12-13 21:47       ` Paul Eggert [this message]
2011-12-13 22:27         ` chad
2011-12-14 14:40         ` Jim Meyering
2011-12-14 18:51           ` Paul Eggert
2011-12-15 23:53             ` Stefan Monnier
2011-12-14  2:40   ` Stefan Monnier
2011-12-15 12:58   ` Jim Meyering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE7C7D4.8050206@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=jim@meyering.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).