From: Martin von Gagern <Martin.vGagern@gmx.net>
To: martin rudalics <rudalics@gmx.at>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: backup-buffer-copy loops if old backup can't be deleted
Date: Wed, 22 Aug 2007 00:21:58 +0200 [thread overview]
Message-ID: <46CB6586.9050005@gmx.net> (raw)
In-Reply-To: <46CB529F.7010008@gmx.at>
[-- Attachment #1.1: Type: text/plain, Size: 1823 bytes --]
martin rudalics wrote:
> Why can't we use
> (copy-file from-name to-name t t)
> here as in Emacs 21?
Good question. Especially since this recreates FILE~ every time.
I can think of at least two scenarios where this could be a problem:
1. The dir is not writable, but the backup file is.
Here the current behaviour will loop and even with the suggested fix
it will fall back to ~/%backup%~ unnecessarily.
2. The backup file is a hard link at should remain such.
This could be wanted in cases where the primary file is a hard link
as well. Don't know how backup-by-rename would handle this.
I originally assumed that emacs would try backup-buffer-copy only after
figuring out that it could not write to the existing backup file, but it
seems I was wrong there, at least if I read backup-buffer correctly.
So I think we want both, first try to reuse the backup file, which
copy-file with ok-if-exists set to t seems to do well. If that fails, we
can assume the file exists, but we are not allowed to write it, so maybe
we can delete it and create it anew. For this we ned the delete followed
by a copy.
Whether we should do any looping in case something goes wrong is another
question. Another process touching the same file just at the critical
moment should be rare situations. I think having the backup fall back
instead of risking a loop would be acceptable in these cases. An
alternative might be to retry a fixed number of times, say 10, and
assume some permanent problem in the logic if we still don't succeed.
Problem is that this approach might bugs go unnoticed more easily, but
with all those different systems out there, there might always be a
combination that we didn't foresee, so a sane default there might be
worth it.
Greetings,
Martin von Gagern
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
next prev parent reply other threads:[~2007-08-21 22:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5018.1187641790.32220.bug-gnu-emacs@gnu.org>
2007-08-20 22:01 ` backup-buffer-copy loops if old backup can't be deleted Martin von Gagern
[not found] ` <mailman.5021.1187647310.32220.bug-gnu-emacs@gnu.org>
2007-08-21 12:18 ` Martin von Gagern
2007-08-21 14:37 ` martin rudalics
2007-08-21 14:51 ` Martin von Gagern
2007-08-21 15:28 ` martin rudalics
2007-08-21 19:35 ` Glenn Morris
2007-08-21 21:01 ` martin rudalics
2007-08-21 21:50 ` Glenn Morris
2007-08-22 9:13 ` Martin von Gagern
2007-08-22 9:44 ` martin rudalics
2007-08-22 9:48 ` Martin von Gagern
2007-08-22 12:40 ` martin rudalics
2007-08-22 21:37 ` Michael Schierl
2007-08-21 22:21 ` Martin von Gagern [this message]
2007-08-22 9:51 ` Ulrich Mueller
2007-08-23 20:59 ` Richard Stallman
2007-08-24 7:13 ` Martin von Gagern
2007-08-24 9:10 ` martin rudalics
2007-08-25 4:07 ` Richard Stallman
2007-08-25 4:07 ` Richard Stallman
[not found] ` <mailman.5219.1187902794.32220.bug-gnu-emacs@gnu.org>
2007-08-24 6:11 ` Ulrich Mueller
2007-08-20 19:58 Martin von Gagern
2007-08-21 6:50 ` martin rudalics
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=46CB6586.9050005@gmx.net \
--to=martin.vgagern@gmx.net \
--cc=bug-gnu-emacs@gnu.org \
--cc=rudalics@gmx.at \
/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).