bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: backup-buffer-copy loops if old backup can't be deleted


From: martin rudalics
Subject: Re: backup-buffer-copy loops if old backup can't be deleted
Date: Tue, 21 Aug 2007 08:50:13 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> The bug occurs when there is a backup file FILE~ for some FILE the user
> modified and wants to save. If the user doesn't have the privileges to
> unlink FILE~, it will try over and over again, resulting in an infinite
> loop. Pressing C-g gets it out of the loop, but the modifications still
> haven't been saved. Backtraces always mention backup-buffer-copy, I
> guess that's where the actual loop happens.

I suppose the `file-error' handler of `backup-buffer-copy'

          (while (condition-case ()
                     (progn
                       (condition-case nil
                           (delete-file to-name)
                         (file-error nil))
                       (copy-file from-name to-name nil t)
                       nil)
                   (file-already-exists t))
            ;; The file was somehow created by someone else between
            ;; `delete-file' and `copy-file', so let's try again.
            nil))

will ignore any error in `delete-file'.  The subsequent `copy-file' will
trigger a `file-already-exists' error and Emacs continues to loop.  In
practice, the `file-already-exists' error is always due to a failure to
delete `to-name' and hardly ever to some strange power creating files in
between.

Likely the `file-error' handler of `backup-buffer' will encounter a
similar fate when `backupname' can't be deleted by `backup-buffer-copy'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]