[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10401: move-file-to-trash trashes default file modes on error
From: |
Paul Eggert |
Subject: |
bug#10401: move-file-to-trash trashes default file modes on error |
Date: |
Thu, 29 Dec 2011 13:13:42 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 |
Tags: patch
move-file-to-trash invokes set-default-file-modes when creating
temporary directories, but if there's an error during directory
creation it doesn't restore the default file modes. This can
cause later files to be created with incorrect permissions.
Here's a patch.
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2011-12-29 13:12:18 +0000
+++ lisp/ChangeLog 2011-12-29 21:08:18 +0000
@@ -1,3 +1,7 @@
+2011-12-29 Paul Eggert <eggert@cs.ucla.edu>
+
+ * files.el (move-file-to-trash): Preserve default file modes on error.
+
2011-12-29 Michael Albinus <michael.albinus@gmx.de>
* net/tramp-sh.el (tramp-find-shell): Set "remote-shell" property
=== modified file 'lisp/files.el'
--- lisp/files.el 2011-12-21 18:33:38 +0000
+++ lisp/files.el 2011-12-29 21:08:18 +0000
@@ -6457,12 +6457,14 @@
;; Ensure that the trash directory exists; otherwise, create it.
(let ((saved-default-file-modes (default-file-modes)))
- (set-default-file-modes ?\700)
- (unless (file-exists-p trash-files-dir)
- (make-directory trash-files-dir t))
- (unless (file-exists-p trash-info-dir)
- (make-directory trash-info-dir t))
- (set-default-file-modes saved-default-file-modes))
+ (unwind-protect
+ (progn
+ (set-default-file-modes #o700)
+ (unless (file-exists-p trash-files-dir)
+ (make-directory trash-files-dir t))
+ (unless (file-exists-p trash-info-dir)
+ (make-directory trash-info-dir t)))
+ (set-default-file-modes saved-default-file-modes)))
;; Try to move to trash with .trashinfo undo information
(save-excursion
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#10401: move-file-to-trash trashes default file modes on error,
Paul Eggert <=