[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107167: Fix bug #4673 with Dired whe
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107167: Fix bug #4673 with Dired when `stat' fails for ".." or other files. |
Date: |
Tue, 07 Feb 2012 19:44:36 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107167
fixes bug(s): http://debbugs.gnu.org/4673
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Tue 2012-02-07 19:44:36 +0200
message:
Fix bug #4673 with Dired when `stat' fails for ".." or other files.
lisp/ls-lisp.el (ls-lisp-sanitize): New function.
(ls-lisp-insert-directory): Use it to fix or remove any elements
in file-alist with missing attributes.
modified:
lisp/ChangeLog
lisp/ls-lisp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-02-07 15:19:52 +0000
+++ b/lisp/ChangeLog 2012-02-07 17:44:36 +0000
@@ -1,3 +1,9 @@
+2012-02-07 Eli Zaretskii <address@hidden>
+
+ * ls-lisp.el (ls-lisp-sanitize): New function.
+ (ls-lisp-insert-directory): Use it to fix or remove any elements
+ in file-alist with missing attributes. (Bug#4673)
+
2012-02-07 Alan Mackenzie <address@hidden>
Fix spurious recognition of c-in-knr-argdecl.
=== modified file 'lisp/ls-lisp.el'
--- a/lisp/ls-lisp.el 2012-01-19 07:21:25 +0000
+++ b/lisp/ls-lisp.el 2012-02-07 17:44:36 +0000
@@ -331,6 +331,7 @@
;; do all bindings here for speed
total-line files elt short file-size attr
fuid fgid uid-len gid-len)
+ (setq file-alist (ls-lisp-sanitize file-alist))
(cond ((memq ?A switches)
(setq file-alist
(ls-lisp-delete-matching "^\\.\\.?$" file-alist)))
@@ -437,6 +438,22 @@
(message "%s: doesn't exist or is inaccessible" file)
(ding) (sit-for 2))))) ; to show user the message!
+(defun ls-lisp-sanitize (file-alist)
+ "Sanitize the elements in FILE-ALIST.
+Fixes any elements in the alist for directory entries whose file
+attributes are nil (meaning that `file-attributes' failed for
+them). This is known to happen for some network shares, in
+particular for the \"..\" directory entry.
+
+If the \"..\" directory entry has nil attributes, the attributes
+are copied from the \".\" entry, if they are non-nil. Otherwise,
+the offending element is removed from the list, as are any
+elements for other directory entries with nil attributes."
+ (if (and (null (cdr (assoc ".." file-alist)))
+ (cdr (assoc "." file-alist)))
+ (setcdr (assoc ".." file-alist) (cdr (assoc "." file-alist))))
+ (rassq-delete-all nil file-alist))
+
(defun ls-lisp-column-format (file-alist)
"Insert the file names (only) in FILE-ALIST into the current buffer.
Format in columns, sorted vertically, following GNU ls -C.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107167: Fix bug #4673 with Dired when `stat' fails for ".." or other files.,
Eli Zaretskii <=