all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Richard <youngfrog@members.fsf.org>
To: 21931@debbugs.gnu.org
Subject: bug#21931: 25.0.50; behaviour of read-directory-name with double slashes
Date: Mon, 16 Nov 2015 07:27:51 +0100	[thread overview]
Message-ID: <86bnaue9w8.fsf@members.fsf.org> (raw)

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





             reply	other threads:[~2015-11-16  6:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16  6:27 Nicolas Richard [this message]
2015-11-20 19:19 ` bug#21931: 25.0.50; behaviour of read-directory-name with double slashes John Wiegley
2015-11-23 14:14   ` Nicolas Richard
2015-11-23 20:58     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86bnaue9w8.fsf@members.fsf.org \
    --to=youngfrog@members.fsf.org \
    --cc=21931@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.