* Trouble with backing up files
@ 2005-04-24 12:21 Eli Zaretskii
0 siblings, 0 replies; only message in thread
From: Eli Zaretskii @ 2005-04-24 12:21 UTC (permalink / raw)
Cc: emacs-devel
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?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-24 12:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-24 12:21 Trouble with backing up files Eli Zaretskii
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).