[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: |
Glenn Morris |
Subject: |
Re: backup-buffer-copy loops if old backup can't be deleted |
Date: |
Tue, 21 Aug 2007 15:35:28 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
How about this:
*** files.el 8 Aug 2007 14:06:01 -0000 1.896.2.15
--- files.el 21 Aug 2007 19:25:34 -0000
***************
*** 3120,3126 ****
(file-error nil))))))
(defun backup-buffer-copy (from-name to-name modes)
! (let ((umask (default-file-modes)))
(unwind-protect
(progn
;; Create temp files with strict access rights. It's easy to
--- 3120,3131 ----
(file-error nil))))))
(defun backup-buffer-copy (from-name to-name modes)
! (let ((umask (default-file-modes))
! (dir (or (file-name-directory to-name)
! default-directory)))
! ;; Can't delete or create files in a read-only directory.
! (unless (file-writable-p dir)
! (signal 'file-error (list "Directory is not writable" dir)))
(unwind-protect
(progn
;; Create temp files with strict access rights. It's easy to
***************
*** 3129,3142 ****
(set-default-file-modes ?\700)
(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))
;; Reset the umask.
(set-default-file-modes umask)))
--- 3134,3149 ----
(set-default-file-modes ?\700)
(while (condition-case ()
(progn
! ;; Failure to delete an existing file is an error.
! (if (file-exists-p to-name)
! (delete-file to-name))
(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.
+ ;; FIXME does that every actually happen in practice?
+ ;; This is a potential infloop, which seems bad...
nil))
;; Reset the umask.
(set-default-file-modes umask)))
- backup-buffer-copy loops if old backup can't be deleted, Martin von Gagern, 2007/08/20
- Re: backup-buffer-copy loops if old backup can't be deleted, Martin von Gagern, 2007/08/20
- Re: backup-buffer-copy loops if old backup can't be deleted, Martin von Gagern, 2007/08/21
- Re: backup-buffer-copy loops if old backup can't be deleted, martin rudalics, 2007/08/21
- Re: backup-buffer-copy loops if old backup can't be deleted, Martin von Gagern, 2007/08/21
- Re: backup-buffer-copy loops if old backup can't be deleted, martin rudalics, 2007/08/21
- Re: backup-buffer-copy loops if old backup can't be deleted,
Glenn Morris <=
- Re: backup-buffer-copy loops if old backup can't be deleted, martin rudalics, 2007/08/21
- Re: backup-buffer-copy loops if old backup can't be deleted, Glenn Morris, 2007/08/21
- Re: backup-buffer-copy loops if old backup can't be deleted, Martin von Gagern, 2007/08/22
- Re: backup-buffer-copy loops if old backup can't be deleted, martin rudalics, 2007/08/22
- Re: backup-buffer-copy loops if old backup can't be deleted, Martin von Gagern, 2007/08/22
- Re: backup-buffer-copy loops if old backup can't be deleted, martin rudalics, 2007/08/22
- Re: backup-buffer-copy loops if old backup can't be deleted, Michael Schierl, 2007/08/22
- Re: backup-buffer-copy loops if old backup can't be deleted, Martin von Gagern, 2007/08/21
- Re: backup-buffer-copy loops if old backup can't be deleted, Ulrich Mueller, 2007/08/22
Re: backup-buffer-copy loops if old backup can't be deleted, Richard Stallman, 2007/08/23