GNU bug report logs - #32274
(interactive "F") silently expands a directory to the current buffer's path

Previous Next

Package: emacs;

Reported by: Andrea Cardaci <cyrus.and <at> gmail.com>

Date: Wed, 25 Jul 2018 22:27:01 UTC

Severity: normal

Tags: notabug

Done: Noam Postavsky <npostavs <at> gmail.com>

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 32274 in the body.
You can then email your comments to 32274 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-gnu-emacs <at> gnu.org:
bug#32274; Package emacs. (Wed, 25 Jul 2018 22:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrea Cardaci <cyrus.and <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 25 Jul 2018 22:27:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrea Cardaci <cyrus.and <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: (interactive "F") silently expands a directory to the current
 buffer's path
Date: Thu, 26 Jul 2018 00:26:17 +0200
[Message part 1 (text/plain, inline)]
The value returned by (interactive "F") is not the one provided by the user.

1. Create a file, say /tmp/foo.el:

(defun foo (path)
  (interactive "F")
  (message path))

2. M-x evaluate-buffer

3. M-x foo and chose /tmp/.

The value presented in the echo area is /tmp/foo.el, this is undesirable
and very dangerous IMHO. It happens with both Emacs 24 and 26.

Is this a bug or I'm overlooking something?


Andrea
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32274; Package emacs. (Wed, 25 Jul 2018 22:50:02 GMT) Full text and rfc822 format available.

Message #8 received at 32274 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Andrea Cardaci <cyrus.and <at> gmail.com>
Cc: 32274 <at> debbugs.gnu.org
Subject: Re: bug#32274: (interactive "F") silently expands a directory to the
 current buffer's path
Date: Wed, 25 Jul 2018 18:49:14 -0400
Andrea Cardaci <cyrus.and <at> gmail.com> writes:

> The value returned by (interactive "F") is not the one provided by the user.
>
> 1. Create a file, say /tmp/foo.el:
>
> (defun foo (path)
>   (interactive "F")
>   (message path))
>
> 2. M-x evaluate-buffer
>
> 3. M-x foo and chose /tmp/.
>
> The value presented in the echo area is /tmp/foo.el, this is undesirable and very dangerous IMHO. It happens with both Emacs 24 and 26.
>
> Is this a bug or I'm overlooking something?

"F" calls read-file-name, passing nil for all args:

    DEFAULT-FILENAME specifies the default file name to return if the
    user exits the minibuffer with the same non-empty string inserted
    by this function [...]  If DEFAULT-FILENAME is omitted or
    nil [...] if the current buffer is visiting a file,
    that file serves as the default [...]

So it seems to be on purpose.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32274; Package emacs. (Wed, 25 Jul 2018 23:41:01 GMT) Full text and rfc822 format available.

Message #11 received at 32274 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Cardaci <cyrus.and <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 32274 <at> debbugs.gnu.org
Subject: Re: bug#32274: (interactive "F") silently expands a directory to the
 current buffer's path
Date: Thu, 26 Jul 2018 01:39:55 +0200
> So it seems to be on purpose.

OK, that makes sense, thank you.

I still don't think it's a wise choice though, besides being prone to
mistakes it also makes it impossible to choose /tmp/ in the above
example, while other directories can be happily selected.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32274; Package emacs. (Thu, 26 Jul 2018 00:47:02 GMT) Full text and rfc822 format available.

Message #14 received at 32274 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Andrea Cardaci <cyrus.and <at> gmail.com>
Cc: 32274 <at> debbugs.gnu.org
Subject: Re: bug#32274: (interactive "F") silently expands a directory to the
 current buffer's path
Date: Wed, 25 Jul 2018 20:46:21 -0400
Andrea Cardaci <cyrus.and <at> gmail.com> writes:

> I still don't think it's a wise choice though, besides being prone to
> mistakes it also makes it impossible to choose /tmp/ in the above
> example, while other directories can be happily selected.

You can enter "/tmp" (i.e., delete the trailing slash), but I guess
(interactive "G") is the behaviour you are looking for.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32274; Package emacs. (Thu, 26 Jul 2018 11:47:02 GMT) Full text and rfc822 format available.

Message #17 received at 32274 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Cardaci <cyrus.and <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 32274 <at> debbugs.gnu.org
Subject: Re: bug#32274: (interactive "F") silently expands a directory to the
 current buffer's path
Date: Thu, 26 Jul 2018 13:46:18 +0200
> You can enter "/tmp" (i.e., delete the trailing slash), but I guess
> (interactive "G") is the behaviour you are looking for.

Yes sure, I just find odd this behavior. Thanks for your time.




Added tag(s) notabug. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 28 Jul 2018 12:50:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 32274 <at> debbugs.gnu.org and Andrea Cardaci <cyrus.and <at> gmail.com> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 28 Jul 2018 12:50:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 26 Aug 2018 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 301 days ago.

Previous Next


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