From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#4673: Not the same as 4674 Date: Sat, 04 Feb 2012 11:05:50 +0200 Message-ID: <83aa4zdl3l.fsf@gnu.org> References: <83vcnodv2j.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1328346392 28775 80.91.229.3 (4 Feb 2012 09:06:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Feb 2012 09:06:32 +0000 (UTC) Cc: 4673@debbugs.gnu.org To: Richard Copley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 04 10:06:31 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RtbZn-0002tU-DS for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Feb 2012 10:06:31 +0100 Original-Received: from localhost ([::1]:36609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtbZm-0005Wr-78 for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Feb 2012 04:06:30 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:35312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtbZi-0005Vl-H1 for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2012 04:06:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtbZh-0007tb-BI for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2012 04:06:26 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtbZh-0007tW-4b for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2012 04:06:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RtbaI-0008NN-7l for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2012 04:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Feb 2012 09:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 4673 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 4673-submit@debbugs.gnu.org id=B4673.132834639732163 (code B ref 4673); Sat, 04 Feb 2012 09:07:02 +0000 Original-Received: (at 4673) by debbugs.gnu.org; 4 Feb 2012 09:06:37 +0000 Original-Received: from localhost ([127.0.0.1]:53090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RtbZt-0008Mi-AJ for submit@debbugs.gnu.org; Sat, 04 Feb 2012 04:06:37 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:49792) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RtbZq-0008MT-Um for 4673@debbugs.gnu.org; Sat, 04 Feb 2012 04:06:36 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LYV008002KRCU00@a-mtaout22.012.net.il> for 4673@debbugs.gnu.org; Sat, 04 Feb 2012 11:05:51 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.149.90]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LYV008AU2LQAK30@a-mtaout22.012.net.il>; Sat, 04 Feb 2012 11:05:51 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:56465 Archived-At: > Date: Fri, 3 Feb 2012 12:17:31 +0000 > From: Richard Copley > Cc: 4673@debbugs.gnu.org >=20 > >> Visiting a Windows DFS share when ".." is not accessible still c= rashes > >> in `ls-lisp-insert-directory' in the trunk of Emacs, as the attr= ibute > >> list for ".." in the `file-alist' returned for by > >> `directory-files-and-attributes' is empty. > > > > What does the following yield for a DFS share? > > > > =A0M-: (file-attributes "//root/share/.." 'string) RET >=20 > nil. >=20 > > For that matter, what does the following cmd command display? > > > > =A0dir /n/q/a:d \\root\share >=20 >=20 > Volume in drive \\root\share is Data > Volume Serial Number is 0123-4567 >=20 > Directory of \\root\share >=20 > 11/11/2011 12:34 BUILTIN\Administrators . > 11/11/2011 12:34 BUILTIN\Administrators .. > 0 File(s) 0 bytes > 2 Dir(s) 123,456,789,000 bytes free 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. =3D=3D=3D modified file 'lisp/ChangeLog' --- lisp/ChangeLog=092012-02-04 02:10:22 +0000 +++ lisp/ChangeLog=092012-02-04 09:00:52 +0000 @@ -1,3 +1,9 @@ +2012-02-04 Eli Zaretskii + +=09* ls-lisp.el (ls-lisp-sanitize): New function. +=09(ls-lisp-insert-directory): Use it to fix or remove any elements +=09in file-alist with missing attributes. (Bug#4673) + 2012-02-04 Glenn Morris =20 =09* image.el (image-extension-data): Add obsolete alias. =3D=3D=3D modified file 'lisp/ls-lisp.el' --- lisp/ls-lisp.el=092012-01-19 07:21:25 +0000 +++ lisp/ls-lisp.el=092012-02-04 08:55:21 +0000 @@ -331,6 +331,7 @@ not contain `d', so that a full listing=20 =09 ;; do all bindings here for speed =09 total-line files elt short file-size attr =09 fuid fgid uid-len gid-len) +=09(setq file-alist (ls-lisp-sanitize file-alist)) =09(cond ((memq ?A switches) =09 (setq file-alist =09=09 (ls-lisp-delete-matching "^\\.\\.?$" file-alist))) @@ -437,6 +438,22 @@ not contain `d', so that a full listing=20 =09(message "%s: doesn't exist or is inaccessible" file) =09(ding) (sit-for 2)))))=09=09; to show user the message! =20 +(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))) +=09 (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 buffe= r. Format in columns, sorted vertically, following GNU ls -C.