From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Martin von Gagern Newsgroups: gmane.emacs.bugs Subject: Re: backup-buffer-copy loops if old backup can't be deleted Date: Wed, 22 Aug 2007 00:21:58 +0200 Message-ID: <46CB6586.9050005@gmx.net> References: <46CAD810.3050904@gmx.net> <46CAF8AC.9070809@gmx.at> <46CAFBEF.2040606@gmx.net> <46CB529F.7010008@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2129157305==" X-Trace: sea.gmane.org 1187734944 31073 80.91.229.12 (21 Aug 2007 22:22:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 21 Aug 2007 22:22:24 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 22 00:22:22 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1INc79-0005U1-En for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Aug 2007 00:22:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1INc78-0000yM-N5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Aug 2007 18:22:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1INc72-0000ve-WC for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2007 18:22:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1INc71-0000uv-Dp for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2007 18:22:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1INc71-0000us-6G for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2007 18:22:11 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1INc70-0005XR-VH for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2007 18:22:11 -0400 Original-Received: (qmail invoked by alias); 21 Aug 2007 22:22:08 -0000 Original-Received: from ppp-88-217-44-103.dynamic.mnet-online.de (EHLO [88.217.44.103]) [88.217.44.103] by mail.gmx.net (mp049) with SMTP; 22 Aug 2007 00:22:08 +0200 X-Authenticated: #858129 X-Provags-ID: V01U2FsdGVkX1+4BsYur7a4qheUCBZEDWPnJk1dCSrMWnHqwKAWmK idkue/qAwFN4Kk User-Agent: Thunderbird 2.0.0.6 (X11/20070817) In-Reply-To: <46CB529F.7010008@gmx.at> X-Enigmail-Version: 0.95.3 X-Y-GMX-Trusted: 0 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16415 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============2129157305== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8BF63B62665013EC21305DB7" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8BF63B62665013EC21305DB7 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable 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 --------------enig8BF63B62665013EC21305DB7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGy2WORhp6o4m9dFsRAhDYAJ99emxgk3Xm78RltC/iW7rQfqEnRQCggYvs NlH3rTzSmHN6rU6j1esQ+5o= =v2wl -----END PGP SIGNATURE----- --------------enig8BF63B62665013EC21305DB7-- --===============2129157305== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ bug-gnu-emacs mailing list bug-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs --===============2129157305==--