unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* incorrect code in dired-insert-directory
@ 2008-02-29  7:08 ` Drew Adams
  2008-02-29 11:01   ` Eli Zaretskii
  2008-06-10 19:20   ` bug#27: marked as done (incorrect code in dired-insert-directory) Emacs bug Tracking System
  0 siblings, 2 replies; 5+ messages in thread
From: Drew Adams @ 2008-02-29  7:08 UTC (permalink / raw)
  To: bug-gnu-emacs

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'
 





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: incorrect code in dired-insert-directory
  2008-02-29  7:08 ` incorrect code in dired-insert-directory Drew Adams
@ 2008-02-29 11:01   ` Eli Zaretskii
  2008-02-29 15:00     ` Drew Adams
  2008-06-10 19:20   ` bug#27: marked as done (incorrect code in dired-insert-directory) Emacs bug Tracking System
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2008-02-29 11:01 UTC (permalink / raw)
  To: Drew Adams; +Cc: bug-gnu-emacs

> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Thu, 28 Feb 2008 23:08:52 -0800
> 
> 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.

If you load files.el in the MS-Windows port, make sure you load
ls-lisp.el right after that.  That's because ls-lisp.el overloads the
standard version of insert-directory, defined by files.el, so loading
files.el reverts you to the original version of insert-directory,
which doesn't DTRT on Windows.

Could it be that the whole problem does not exist if you load
ls-lisp.el after files.el?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: incorrect code in dired-insert-directory
  2008-02-29 11:01   ` Eli Zaretskii
@ 2008-02-29 15:00     ` Drew Adams
  2008-03-02  5:20       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2008-02-29 15:00 UTC (permalink / raw)
  To: 'Eli Zaretskii'; +Cc: bug-gnu-emacs

> > 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.
> 
> If you load files.el in the MS-Windows port, make sure you load
> ls-lisp.el right after that.  That's because ls-lisp.el overloads the
> standard version of insert-directory, defined by files.el, so loading
> files.el reverts you to the original version of insert-directory,
> which doesn't DTRT on Windows.
> 
> Could it be that the whole problem does not exist if you load
> ls-lisp.el after files.el?

Good catch. That was it. No bug I guess.

Nevertheless, would it make sense to:

- Fix that regexp string anyway, to be Windows compatible? Or add a comment
saying that it is not and need not be?

- Add a comment in files.el or dired.el (or both) saying something about the
fact that Windows redefines insert-directory in ls-lisp.el?

FWIW, I spent quite a while trying to figure out what was actually happening
and why (and I obviously didn't succeed completely). A comment in the source
code might have helped me understand.

Thx.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: incorrect code in dired-insert-directory
  2008-02-29 15:00     ` Drew Adams
@ 2008-03-02  5:20       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2008-03-02  5:20 UTC (permalink / raw)
  To: Drew Adams; +Cc: bug-gnu-emacs

> - Add a comment in files.el or dired.el (or both) saying something about the
> fact that Windows redefines insert-directory in ls-lisp.el?

Better yet: fix the code so that the same function is not defined at
two places.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#27: marked as done (incorrect code in dired-insert-directory)
  2008-02-29  7:08 ` incorrect code in dired-insert-directory Drew Adams
  2008-02-29 11:01   ` Eli Zaretskii
@ 2008-06-10 19:20   ` Emacs bug Tracking System
  1 sibling, 0 replies; 5+ messages in thread
From: Emacs bug Tracking System @ 2008-06-10 19:20 UTC (permalink / raw)
  To: Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]


Your message dated Tue, 10 Jun 2008 15:11:31 -0400
with message-id <jwvy75dqf65.fsf-monnier+emacsbugreports@gnu.org>
and subject line Re: incorrect code in dired-insert-directory
has caused the Emacs bug report #27,
regarding incorrect code in dired-insert-directory
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
27: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=27
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 6429 bytes --]

From: "Drew Adams" <drew.adams@oracle.com>
To: <bug-gnu-emacs@gnu.org>
Subject: incorrect code in dired-insert-directory
Date: Thu, 28 Feb 2008 23:08:52 -0800
Message-ID: <001f01c87aa1$f176d7c0$0600a8c0@us.oracle.com>

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'
 





[-- Attachment #3: Type: message/rfc822, Size: 2250 bytes --]

From: Stefan Monnier <monnier@iro.umontreal.ca>
To: 27-done@emacsbugs.donarmstrong.com
Subject: Re: incorrect code in dired-insert-directory
Date: Tue, 10 Jun 2008 15:11:31 -0400
Message-ID: <jwvy75dqf65.fsf-monnier+emacsbugreports@gnu.org>

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-10 19:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <jwvy75dqf65.fsf-monnier+emacsbugreports@gnu.org>
2008-02-29  7:08 ` incorrect code in dired-insert-directory Drew Adams
2008-02-29 11:01   ` Eli Zaretskii
2008-02-29 15:00     ` Drew Adams
2008-03-02  5:20       ` Stefan Monnier
2008-06-10 19:20   ` bug#27: marked as done (incorrect code in dired-insert-directory) Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).