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

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

[debbugs-tracker] bug#10401: closed (move-file-to-trash trashes default


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#10401: closed (move-file-to-trash trashes default file modes on error)
Date: Sat, 07 Jan 2012 20:07:02 +0000

Your message dated Sat, 07 Jan 2012 12:06:09 -0800
with message-id <address@hidden>
and subject line patch installed
has caused the debbugs.gnu.org bug report #10401,
regarding move-file-to-trash trashes default file modes on error
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
10401: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10401
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 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  <address@hidden>
+
+       * files.el (move-file-to-trash): Preserve default file modes on error.
+
 2011-12-29  Michael Albinus  <address@hidden>
 
        * 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




--- End Message ---
--- Begin Message --- Subject: patch installed Date: Sat, 07 Jan 2012 12:06:09 -0800 User-agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0
I installed this patch into the Emacs trunk as part of
bzr 106821 and am marking the bug as done.


--- End Message ---

reply via email to

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