GNU bug report logs - #27
incorrect code in dired-insert-directory

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 3 Mar 2008 03:05:05 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27 in the body.
You can then email your comments to 27 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#27; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: incorrect code in dired-insert-directory
Date: Thu, 28 Feb 2008 23:08:52 -0800
This line near the end of dired-insert-directory is wrong:
 
 (if (and (or hdr wildcard) (not (looking-at "^  /.*:$")))
 
The problem is that "^ /.*:$" does not recognize a directory name on
MS Windows. The purpose of this code is to see if the directory name
is already in the buffer - if not, then it adds it. The test always
fails on Windows, so, whenever (or hdr wildcard) is non-nil, the `if'
test succeeds. That inserts a second copy of the directory name in the
buffer in some situations.
 
The regexp works only for Unix and GNU/Linux, not for Windows, which
has directories that have drive letters: c:/foobar/.

To reproduce (on Windows):

emacs -Q
Load the source file files.el.

C-u C-x 4 d 

Use switches -lR, and enter some directory name.

The first directory name in the buffer appears twice (the others are OK).

Note: The problem does not seem to arise if you don't load the source file,
for some reason.

This problem also exists in 22.1.90. And it exists as far back as Emacs 20.
 

In GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600)
 of 2007-06-02 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'
 






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#27; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 27 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 27 <at> debbugs.gnu.org
Subject: Re: incorrect code in dired-insert-directory
Date: Sun, 20 Apr 2008 09:46:40 -0400
> This line near the end of dired-insert-directory is wrong:
> 
>  (if (and (or hdr wildcard) (not (looking-at "^  /.*:$")))
> 
> The problem is that "^ /.*:$" does not recognize a directory name on
> MS Windows... The regexp works only for Unix and GNU/Linux, not for
> Windows, which has directories that have drive letters

Patch welcome (I'd work on this, but I can't test it since I don't have
Windows available).




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #15 received at 27-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 27-done <at> debbugs.gnu.org
Subject: Re: incorrect code in dired-insert-directory
Date: Tue, 10 Jun 2008 15:11:31 -0400
I believe this was fixed by the patch below,


        Stefan


--- dired.el.~1.399.~	2008-06-06 21:10:43.000000000 -0400
+++ dired.el	2008-06-10 15:09:37.000000000 -0400
@@ -1044,7 +1044,9 @@
     ;; Insert text at the beginning to standardize things.
     (save-excursion
       (goto-char opoint)
-      (if (and (or hdr wildcard) (not (looking-at "^  /.*:$")))
+      (if (and (or hdr wildcard)
+               (not (and (looking-at "^  \\(.*\\):$")
+                         (file-name-absolute-p (match-string 1)))))
 	  ;; Note that dired-build-subdir-alist will replace the name
 	  ;; by its expansion, so it does not matter whether what we insert
 	  ;; here is fully expanded, but it should be absolute.




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Wed, 09 Jul 2008 14:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.