emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106365: Small executable.el fix rela


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106365: Small executable.el fix related to bug#9879.
Date: Sun, 13 Nov 2011 18:14:01 -0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106365
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sun 2011-11-13 18:14:01 -0800
message:
  Small executable.el fix related to bug#9879.
  
  * lisp/progmodes/executable.el
  (executable-make-buffer-file-executable-if-script-p):
  Handle file-modes returning nil.
modified:
  lisp/ChangeLog
  lisp/progmodes/executable.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-11-14 02:01:00 +0000
+++ b/lisp/ChangeLog    2011-11-14 02:14:01 +0000
@@ -1,5 +1,9 @@
 2011-11-14  Glenn Morris  <address@hidden>
 
+       * progmodes/executable.el
+       (executable-make-buffer-file-executable-if-script-p):
+       Handle file-modes returning nil.
+
        * mail/rmail.el (rmail-no-mail-p): Remove mode-line N/M indicator.
 
        * mail/rmailsum.el (rmail-summary, rmail-new-summary)

=== modified file 'lisp/progmodes/executable.el'
--- a/lisp/progmodes/executable.el      2011-04-22 18:44:26 +0000
+++ b/lisp/progmodes/executable.el      2011-11-14 02:14:01 +0000
@@ -268,12 +268,16 @@
        (save-restriction
         (widen)
         (string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))
-       (let* ((current-mode (file-modes (buffer-file-name)))
-              (add-mode (logand ?\111 (default-file-modes))))
-         (or (/= (logand ?\111 current-mode) 0)
-             (zerop add-mode)
-             (set-file-modes (buffer-file-name)
-                             (logior current-mode add-mode))))))
+       (condition-case nil
+           (let* ((current-mode (file-modes (buffer-file-name)))
+                  (add-mode (logand ?\111 (default-file-modes))))
+             (or (/= (logand ?\111 current-mode) 0)
+                 (zerop add-mode)
+                 (set-file-modes (buffer-file-name)
+                                 (logior current-mode add-mode))))
+         ;; Eg file-modes can return nil (bug#9879).  It should not,
+         ;; in this context, but we should handle it all the same.
+         (error (message "Unable to make file executable")))))
 
 (provide 'executable)
 


reply via email to

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