unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Eli Zaretskii" <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Trouble with backing up files
Date: Sun, 24 Apr 2005 15:21:08 +0300	[thread overview]
Message-ID: <01c548c8$Blat.v2.4$3d433180@zahav.net.il> (raw)

These recent changes:

	(backup-buffer-copy, basic-save-buffer-2): Take care against
	writing thru an unexpected existing symlink.

break saving of precious files (those for which file-precious-flag is
non-nil): Emacs always says that it cannot backup the file, and tries
to back it up in ~/%backup%~ (which also fails: it creates an empty
file by that name, but doesn't write the original file's contents
there).

I tracked the problem to this snippet in backup-buffer-copy:

	  (while (condition-case ()
		     (progn
		       (condition-case nil
			   (delete-file to-name)
			 (file-error nil))
		       (write-region "" nil to-name nil 'silent nil 'excl)
		       nil)
		   (file-already-exists t))
	    ;; the file was somehow created by someone else between
	    ;; `make-temp-name' and `write-region', let's try again.
	    nil)
	  (copy-file from-name to-name t t 'excl))

This deletes the destination file to-name, then creates an empty file
by the same name.  It then attempts to copy the material from the
original file from-name by calling copy-file with the new arg
MUSTBENEW set to `excl', which of course fails, since we just created
a file by that name when write-region was called.

For now, I fixed this by removing the `excl' arg from the call to
copy-file, but I'm not sure this is the right fix, since this is the
only place where copy-file is called with that argument, and so the
reason for introducing it is unclear.

Richard, could you please explain why you made those changes and
perhaps also say a few words about the implementation, including the
need for the new optional arg of copy-file?

                 reply	other threads:[~2005-04-24 12:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='01c548c8$Blat.v2.4$3d433180@zahav.net.il' \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).