GNU bug report logs -
#21931
25.0.50; behaviour of read-directory-name with double slashes
Previous Next
Reported by: Nicolas Richard <youngfrog <at> members.fsf.org>
Date: Mon, 16 Nov 2015 06:29:01 UTC
Severity: normal
Found in version 25.0.50
Done: Nicolas Richard <youngfrog <at> members.fsf.org>
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 21931 in the body.
You can then email your comments to 21931 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21931
; Package
emacs
.
(Mon, 16 Nov 2015 06:29:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nicolas Richard <youngfrog <at> members.fsf.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 16 Nov 2015 06:29:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
After I eval:
(let ((default-directory "/tmp"))
(list (read-directory-name "foo" "/tmp/src/")
(read-directory-name "foo" "/tmp/src//")
(read-directory-name "foo" "src/")
(read-directory-name "foo" "src//")
(read-directory-name "foo" "foo//src/")
(read-directory-name "foo" "foo//src//")))
and hit RET RET RET RET, I get :
("/tmp/src/" "/" "src/" "/" "/src/" "/")
Is this intended ?
We could normalize the directory name via expand-file-name in all cases,
e.g. :
modified lisp/files.el
@@ -648,8 +648,7 @@ read-directory-name
(unless dir
(setq dir default-directory))
(read-file-name prompt dir (or default-dirname
- (if initial (expand-file-name initial dir)
- dir))
+ (expand-file-name (or initial "") dir))
mustmatch initial
'file-directory-p))
but the docstring states "Value is not expanded---you must call
`expand-file-name' yourself." so I guess the behaviour is important (and
I guess e.g. for tramp).
Should read-file-name be fixed or should the callers make sure to not
use double slashes ?
In GNU Emacs 25.0.50.1 (i686-pc-linux-gnu, X toolkit, Xaw scroll bars)
of 2015-11-14
Repository revision: ed2e7e20ae0945288c98091f308f5460c3453873
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04.3 LTS
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21931
; Package
emacs
.
(Fri, 20 Nov 2015 19:22:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 21931 <at> debbugs.gnu.org (full text, mbox):
>>>>> Nicolas Richard <youngfrog <at> members.fsf.org> writes:
> ("/tmp/src/" "/" "src/" "/" "/src/" "/")
> Is this intended ?
What list were you expecting to see? "//" has always meant "start at root" to
mean, ignoring whatever comes prior. This is how C-x C-f works, and it means
you don't have to delete any existing default text in order to begin at root.
John
Reply sent
to
Nicolas Richard <youngfrog <at> members.fsf.org>
:
You have taken responsibility.
(Mon, 23 Nov 2015 14:16:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Nicolas Richard <youngfrog <at> members.fsf.org>
:
bug acknowledged by developer.
(Mon, 23 Nov 2015 14:16:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 21931-done <at> debbugs.gnu.org (full text, mbox):
John Wiegley writes:
>>>>>> Nicolas Richard <youngfrog <at> members.fsf.org> writes:
>
>> ("/tmp/src/" "/" "src/" "/" "/src/" "/")
>> Is this intended ?
>
> What list were you expecting to see? "//" has always meant "start at root" to
> mean, ignoring whatever comes prior. This is how C-x C-f works, and it means
> you don't have to delete any existing default text in order to begin at root.
Indeed, but when constructing a path via (concat foo "/" bar), it can
happen that the result contains //. If this is then used as arg to
read-directory-name, this leads to an unexpected default.
OTOH (info "(elisp) Directory Names") explicitly says that using concat
for constructing paths in this way is wrong, so I guess that this bug
report is void.
Thanks for looking into it, I close it.
Nico.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21931
; Package
emacs
.
(Mon, 23 Nov 2015 20:59:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 21931 <at> debbugs.gnu.org (full text, mbox):
Nicolas Richard <youngfrog <at> members.fsf.org> writes:
>> What list were you expecting to see? "//" has always meant "start at root" to
>> mean, ignoring whatever comes prior. This is how C-x C-f works, and it means
>> you don't have to delete any existing default text in order to begin at root.
>
> Indeed, but when constructing a path via (concat foo "/" bar), it can
> happen that the result contains //. If this is then used as arg to
> read-directory-name, this leads to an unexpected default.
(expand-file-name bar foo) is your choice. If you dislike it, take
(concat (directory-file-name foo) "/" bar)
> Thanks for looking into it, I close it.
>
> Nico.
Best regards, Michael.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 22 Dec 2015 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.