From: Madhu <enometh@meer.net>
To: eliz@gnu.org
Cc: monnier@iro.umontreal.ca, 74208@debbugs.gnu.org
Subject: bug#74208: 31.0.50; minibuffer read-file-name-default mutates global value of default-directory incorrectly
Date: Sun, 10 Nov 2024 12:30:07 +0530 (IST) [thread overview]
Message-ID: <20241110.123007.483734644166546380.enometh@meer.net> (raw)
In-Reply-To: <86msi7ljb0.fsf@gnu.org>
* Eli Zaretskii <eliz@gnu.org> <86msi7ljb0.fsf@gnu.org>
Wrote on Sun, 10 Nov 2024 08:00:35 +0200
>> --- a/lisp/minibuffer.el
>> +++ b/lisp/minibuffer.el
>> @@ -3668,10 +3668,11 @@ read-file-name-default
>> ;; changing `default-directory' in the current buffer,
>> ;; we don't let-bind it.
>> (let ((dir (file-name-as-directory
>> - (expand-file-name dir))))
>> + (expand-file-name dir)))
>> + (default-directory (if (file-name-absolute-p dir)
>> + dir default-directory)))
> You probably meant to use let*, right?
Oops. yes, of course.
> But anyway, I don't understand the logic: expand-file-name always
> returns an absolute file name, so the test will always succeed. What
> did I miss?
for the example in the thread,
ffap.el:(ffap-read-file-or-url) calls read-file-name-default, via
(funcall #'read-file-name-default prompt guess guess) =>
read-file-name-default("Find file or URL: " "http://example.com" "http://example.com")
(read-file-name-default PROMPT &optional DIR DEFAULT-FILENAME
MUSTMATCH INITIAL PREDICATE)
The problem is that the parameter DIR == "http://example.com" was
getting bound to default-directory with undesirable results. DIR a url
not a file name but a url. and since expand-file-name behaves like
this:
(expand-file-name "http://example.com" "~") -> "http://example.com"
it can probably be used to determine that DIR is not a legit filename
and default directory should not be bound to it. I don't think it has
any consequences for the completion-system completion via
read-file-name, which would not work anyway (and completing urls in
this context say matching against a history list of urls would not
make sense either)
next prev parent reply other threads:[~2024-11-10 7:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 2:09 bug#74208: 31.0.50; minibuffer read-file-name-default mutates global value of default-directory incorrectly Madhu
2024-11-09 11:11 ` Eli Zaretskii
2024-11-09 16:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-10 0:57 ` Madhu
2024-11-10 6:00 ` Eli Zaretskii
2024-11-10 7:00 ` Madhu [this message]
2024-11-10 10:00 ` Eli Zaretskii
2024-11-10 10:41 ` Madhu
2024-11-10 10:45 ` Eli Zaretskii
2024-11-10 11:17 ` Madhu
2024-11-10 11:26 ` Eli Zaretskii
2024-11-10 16:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-11 2:17 ` Madhu
2024-11-11 3:40 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-23 12:25 ` Eli Zaretskii
2024-11-23 14:56 ` Madhu
2024-11-24 3:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-24 7:19 ` Eli Zaretskii
2024-12-07 12:20 ` Eli Zaretskii
2024-12-07 17:23 ` Madhu
2024-12-07 18:27 ` Eli Zaretskii
2024-12-08 8:46 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 10:49 ` Madhu
2024-12-08 11:33 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 11:59 ` Madhu
2024-12-08 15:13 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 16:26 ` Madhu
2024-12-08 17:28 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 23:42 ` Madhu
2024-12-09 8:17 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=20241110.123007.483734644166546380.enometh@meer.net \
--to=enometh@meer.net \
--cc=74208@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.