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

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

bug#4673: Not the same as 4674


From: Richard Copley
Subject: bug#4673: Not the same as 4674
Date: Tue, 7 Feb 2012 15:30:12 +0000

On 4 February 2012 09:05, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Fri, 3 Feb 2012 12:17:31 +0000
>> From: Richard Copley <rcopley@gmail.com>
>> Cc: 4673@debbugs.gnu.org
>>
>> >> Visiting a Windows DFS share when ".." is not accessible still crashes
>> >> in `ls-lisp-insert-directory' in the trunk of Emacs, as the attribute
>> >> list for ".." in the `file-alist' returned for by
>> >> `directory-files-and-attributes' is empty.
...
> Can you test the patch below?  I don't have access to such shares, so
> I cannot test it myself.  TIA.
>
> Since ls-lisp.el is preloaded, you will either need to rebuild Emacs
> (if you have the development environment and the Emacs sources), or
> manually load the patched ls-lisp.el before invoking Dired.
>
> === modified file 'lisp/ChangeLog'
> --- lisp/ChangeLog      2012-02-04 02:10:22 +0000
> +++ lisp/ChangeLog      2012-02-04 09:00:52 +0000
> @@ -1,3 +1,9 @@
> +2012-02-04  Eli Zaretskii  <eliz@gnu.org>
> +
> +       * 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-04  Glenn Morris  <rgm@gnu.org>
>
>        * image.el (image-extension-data): Add obsolete alias.
>
> === modified file 'lisp/ls-lisp.el'
> --- lisp/ls-lisp.el     2012-01-19 07:21:25 +0000
> +++ lisp/ls-lisp.el     2012-02-04 08:55:21 +0000
> @@ -331,6 +331,7 @@ not contain `d', so that a full listing
>             ;; 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 @@ not contain `d', so that a full listing
>        (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.
>

I rebuilt from the patched sources, and (dired "//root/share") works
fine here now.
Thanks!





reply via email to

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