GNU bug report logs - #10458
24.0.92; ! in dired on a file starting with a hyphen

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Sun, 8 Jan 2012 20:13:01 UTC

Severity: minor

Found in version 24.0.92

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.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 10458 in the body.
You can then email your comments to 10458 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#10458; Package emacs. (Sun, 08 Jan 2012 20:13:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to michael_heerdegen <at> web.de:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 08 Jan 2012 20:13:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Cc: Drew Adams <drew.adams <at> oracle.com>
Subject: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 08 Jan 2012 21:05:37 +0100
Hello,

Please see #2536 for a similar issue.

I'm working with Gnu/Linux.  If I hit ! in dired on a file starting with
"-", the hyphen is not quoted so that the specified program will
interpret the file name as an option.  I guess this is nearly never
what the user wants.


In GNU Emacs 24.0.92.1 (i486-pc-linux-gnu, GTK+ Version 3.2.3)
 of 2012-01-05 on zelenka, modified by Debian
 (emacs-snapshot package, version 1:20120105-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11102902
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.0.92/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.92/site-lisp:/usr/share/emacs/site-lisp' '--without-compress-info' '--with-crt-dir=/usr/lib/i386-linux-gnu/' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2''

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Mon, 09 Jan 2012 01:31:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: michael_heerdegen <at> web.de
Cc: 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 08 Jan 2012 20:30:18 -0500
> I'm working with Gnu/Linux.  If I hit ! in dired on a file starting with
> "-", the hyphen is not quoted so that the specified program will
> interpret the file name as an option.  I guess this is nearly never
> what the user wants.

Indeed.  Quoting the file name by doing something like:

    foobar '-toto' titi

won't help (`foobar' won't see the quoting anyway because the shell
will strip it away before passing the result to `foobar').
But we could do something like:

   foobar ./-toto titi

which would not suffer from this problem.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Mon, 09 Jan 2012 17:28:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Mon, 09 Jan 2012 12:27:30 -0500
Stefan Monnier wrote:

> But we could do something like:
>
>    foobar ./-toto titi

Or stick a "--" after the command (is that a universal convention?). if
the user did not supply one. This is also what anyone could use to work
around the problem in the meantime.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Mon, 09 Jan 2012 19:42:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Mon, 09 Jan 2012 21:39:47 +0200
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Mon, 09 Jan 2012 12:27:30 -0500
> Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
> 
> Stefan Monnier wrote:
> 
> > But we could do something like:
> >
> >    foobar ./-toto titi
> 
> Or stick a "--" after the command (is that a universal convention?).

AFAIK, -- is supported only by GNU getopt (and maybe compatibles).  I
think there's no guarantee that an arbitrary program will support it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Mon, 09 Jan 2012 22:41:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Glenn Morris <rgm <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Mon, 09 Jan 2012 17:40:37 -0500
>> But we could do something like:
>> foobar ./-toto titi
> Or stick a "--" after the command (is that a universal convention?)

not only I don't think it's a universal convention, but I can't think of
any easy reliable way to do that.  E.g. compare

    gcc -o foo -toto.c
vs
    gcc -c foo.c -toto.c


-- Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 00:41:02 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, rgm <at> gnu.org, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Mon, 09 Jan 2012 19:40:25 -0500
    AFAIK, -- is supported only by GNU getopt (and maybe compatibles).  I
    think there's no guarantee that an arbitrary program will support it.

If you encounter a program that doesn't use GNU getopt
or equivalent, please suggest adopting that feature.
It would be convenient for users if all programs supported it.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use free telephony http://directory.fsf.org/category/tel/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 07:05:02 GMT) Full text and rfc822 format available.

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

From: "Jan D." <jan.h.d <at> swipnet.se>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, Glenn Morris <rgm <at> gnu.org>, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 10 Jan 2012 08:04:03 +0100
Stefan Monnier skrev 2012-01-09 23:40:
>>> But we could do something like:
>>> foobar ./-toto titi
>> Or stick a "--" after the command (is that a universal convention?)
>
> not only I don't think it's a universal convention, but I can't think of
> any easy reliable way to do that.  E.g. compare
>
>      gcc -o foo -toto.c
> vs
>      gcc -c foo.c -toto.c
>

It is universal in that it is in POSIX 1003.1.

	Jan D.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 09:03:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 10 Jan 2012 04:02:25 -0500
Stefan Monnier wrote:

> not only I don't think it's a universal convention, but I can't think of
> any easy reliable way to do that.  E.g. compare
>
>     gcc -o foo -toto.c
> vs
>     gcc -c foo.c -toto.c

Then perhaps it is academic, but I see no ambiguity, since dired keeps
command and file(s) to operate on separate:

  ! gcc -o foo RET
  ! gcc -c RET

It's not like we have to try and decode an entire arbitrary command
string.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 14:25:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Glenn Morris <rgm <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 10 Jan 2012 09:23:54 -0500
> Then perhaps it is academic, but I see no ambiguity, since dired keeps
> command and file(s) to operate on separate:

>   ! gcc -o foo RET
>   ! gcc -c RET

How 'bout "! diff -u oldfoo RET"?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 17:12:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 10 Jan 2012 12:11:27 -0500
Stefan Monnier wrote:

> How 'bout "! diff -u oldfoo RET"?

<shakes fist>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 17:19:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 10 Jan 2012 12:18:25 -0500
> Stefan Monnier wrote:
>
>> How 'bout "! diff -u oldfoo RET"?

Actually, GNU diff accepts this just fine:

  diff -u oldfoo -- -newfoo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 20:05:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Glenn Morris <rgm <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 10 Jan 2012 15:03:49 -0500
>>> How 'bout "! diff -u oldfoo RET"?
> Actually, GNU diff accepts this just fine:
>   diff -u oldfoo -- -newfoo

Interesting.  So we need yet another hack in case the file is named
"--".


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 10 Jan 2012 21:47:01 GMT) Full text and rfc822 format available.

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

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, Glenn Morris <rgm <at> gnu.org>, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 10 Jan 2012 22:45:49 +0100
10 jan 2012 kl. 21:03 skrev Stefan Monnier:

>>>> How 'bout "! diff -u oldfoo RET"?
>> Actually, GNU diff accepts this just fine:
>>  diff -u oldfoo -- -newfoo
> 
> Interesting.  So we need yet another hack in case the file is named
> "--".

diff -u oldfoo -- --

should work.

	Jan D.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Sun, 20 Feb 2022 13:51:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 20 Feb 2022 14:50:36 +0100
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> Indeed.  Quoting the file name by doing something like:
>
>     foobar '-toto' titi
>
> won't help (`foobar' won't see the quoting anyway because the shell
> will strip it away before passing the result to `foobar').
> But we could do something like:
>
>    foobar ./-toto titi
>
> which would not suffer from this problem.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

The discussion then turned to whether "--" was a possibility, and it
isn't.

But adding ./ to file names that start with - should be safe, I think?
So I've now done that in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 10458 <at> debbugs.gnu.org and michael_heerdegen <at> web.de Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 20 Feb 2022 13:51:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Sun, 20 Feb 2022 14:08:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 20 Feb 2022 16:07:18 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Sun, 20 Feb 2022 14:50:36 +0100
> Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
> 
> But adding ./ to file names that start with - should be safe, I think?

It changes semantics.  The list of file names passed to a command
doesn't necessarily mean "open each file and process it", it could
mean something else, like "make a list of files".  So I don't think we
should do that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Sun, 20 Feb 2022 14:11:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 20 Feb 2022 15:10:05 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> It changes semantics.  The list of file names passed to a command
> doesn't necessarily mean "open each file and process it", it could
> mean something else, like "make a list of files".  So I don't think we
> should do that.

Commands like "echo" will behave differently, but I tried to imagine
other functions where this would make a difference, and I failed.  Do
you have any examples?

The old behaviour would misbehave for the vast majority of commands, so
I think it's an improvement.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Sun, 20 Feb 2022 14:25:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 20 Feb 2022 16:23:55 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: monnier <at> IRO.UMontreal.CA,  michael_heerdegen <at> web.de,  10458 <at> debbugs.gnu.org
> Date: Sun, 20 Feb 2022 15:10:05 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > It changes semantics.  The list of file names passed to a command
> > doesn't necessarily mean "open each file and process it", it could
> > mean something else, like "make a list of files".  So I don't think we
> > should do that.
> 
> Commands like "echo" will behave differently, but I tried to imagine
> other functions where this would make a difference, and I failed.  Do
> you have any examples?

Here:

   find /foo/bar -name %f

I think substituting "./bar" for %f has different semantics that
"bar", doesn't it?

Basically, any scenario where "foo" doesn't mean 'the file "foo" in
the directory where the command is invoked'.

> The old behaviour would misbehave for the vast majority of commands, so
> I think it's an improvement.

In some cases, yes.  I'm worried about those where it changes the
meaning, and the fact that we do this silently.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Sun, 20 Feb 2022 14:33:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 20 Feb 2022 15:31:56 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> Here:
>
>    find /foo/bar -name %f
>
> I think substituting "./bar" for %f has different semantics that
> "bar", doesn't it?

Hm, right.  I guess that's a possible command somebody could use (even
though it doesn't work well in general (if you've ticked several files)).

But note that it doesn't replace "bar" with "./bar" -- it only does this
if the file name starts with "-".

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Sun, 20 Feb 2022 14:41:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 20 Feb 2022 16:40:18 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: monnier <at> IRO.UMontreal.CA,  michael_heerdegen <at> web.de,  10458 <at> debbugs.gnu.org
> Date: Sun, 20 Feb 2022 15:31:56 +0100
> 
> But note that it doesn't replace "bar" with "./bar" -- it only does this
> if the file name starts with "-".

Sure.  Which is why the problems will be rare and subtle.

Btw, the "usual" way of telling a program "all arguments from here on
are not options" is to use "--".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Sun, 20 Feb 2022 15:15:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Sun, 20 Feb 2022 10:14:36 -0500
> But adding ./ to file names that start with - should be safe, I think?
> So I've now done that in Emacs 29.

The problem with that is that it's hackish and ad-hoc.  It will
sometimes do the right thing, but other times it' not what's expected
and users will find it odd.

An alternative is to pass absolute file names.  And I think it would
make sense in that case to let the user choose between relative names
and absolute names.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Mon, 21 Feb 2022 13:48:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Mon, 21 Feb 2022 14:46:53 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> Btw, the "usual" way of telling a program "all arguments from here on
> are not options" is to use "--".

It's not supported by all commands, though.  (And it would fail even
more in the "find" example.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Mon, 21 Feb 2022 13:50:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Mon, 21 Feb 2022 14:49:06 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> The problem with that is that it's hackish and ad-hoc.  It will
> sometimes do the right thing, but other times it' not what's expected
> and users will find it odd.

Statistically speaking, it'll work on more cases than `!' used to,
though.  I'm pretty sure.  And I think it's fine for a command like `!'
to try to DWIM.

> An alternative is to pass absolute file names.  And I think it would
> make sense in that case to let the user choose between relative names
> and absolute names.

Giving absolute names would break more stuff than the DWIM tweak,
though, so we can't default to that.  And if we can't default to having
`!' work for files like this, there isn't much point.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 22 Feb 2022 01:33:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 10458 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 22 Feb 2022 02:32:03 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Giving absolute names would break more stuff than the DWIM tweak,
> though, so we can't default to that.

What kinds of stuff would typically break if we did that?

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 22 Feb 2022 01:34:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 10458 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 22 Feb 2022 02:33:24 +0100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

>> Giving absolute names would break more stuff than the DWIM tweak,
>> though, so we can't default to that.
>
> What kinds of stuff would typically break if we did that?

See Eli's example.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 22 Feb 2022 02:52:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Mon, 21 Feb 2022 21:51:43 -0500
>> The problem with that is that it's hackish and ad-hoc.  It will
>> sometimes do the right thing, but other times it' not what's expected
>> and users will find it odd.
>
> Statistically speaking, it'll work on more cases than `!' used to,
> though.  I'm pretty sure.  And I think it's fine for a command like `!'
> to try to DWIM.

I was thinking of making it less-DWIMish and leave it in control of
the user.  IOW, rather than try to magically "do the right thing" for
files starting with `-`, allow the users to request explicitly absolute
file names (maybe with a prefix command or something like that) when
*they* see it's needed.

It won't fix the user's mistakes, but it will give a simpler semantics
on which powerusers can more easily rely.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Tue, 22 Feb 2022 13:30:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: michael_heerdegen <at> web.de, 10458 <at> debbugs.gnu.org
Subject: Re: bug#10458: 24.0.92; ! in dired on a file starting with a hyphen
Date: Tue, 22 Feb 2022 14:29:06 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> I was thinking of making it less-DWIMish and leave it in control of
> the user.  IOW, rather than try to magically "do the right thing" for
> files starting with `-`, allow the users to request explicitly absolute
> file names (maybe with a prefix command or something like that) when
> *they* see it's needed.

The prefix is already taken on the `!' command...

> It won't fix the user's mistakes, but it will give a simpler semantics
> on which powerusers can more easily rely.

Using -file-names as they are is a usability problem, and may be a
security problem (the file name may have been created by someone with
the idea in mind that interpreted as a command line switch it'll lead to
nefarious results), so I don't think `!' should go back to the old
behaviour by default.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Mar 2022 11:24:08 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Drew Adams <drew.adams <at> oracle.com> to control <at> debbugs.gnu.org. (Mon, 28 Mar 2022 02:59:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10458; Package emacs. (Mon, 28 Mar 2022 03:03:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Lars Ingebrigtsen
 <larsi <at> gnus.org>, "michael_heerdegen <at> web.de" <michael_heerdegen <at> web.de>,
 "10458 <at> debbugs.gnu.org" <10458 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#10458: 24.0.92; ! in dired on a file starting
 with a hyphen
Date: Mon, 28 Mar 2022 03:02:44 +0000
> > But adding ./ to file names that start with - should be safe, I
> > think?  So I've now done that in Emacs 29.
> 
> The problem with that is that it's hackish and ad-hoc.  It will
> sometimes do the right thing, but other times it' not what's expected
> and users will find it odd.

FWIW, I think the cure is worse than the problem.

And as Michael indicated, a similar problem was
reported in bug #2536.

No simple solution has been found.  The simplistic
one you've (apparently) adopted is, I think, a bad
idea.  Better to just document this (and similarly
for bug #2536) as a limitation of `!' (and `&' and
`M-!').

That at least gives straightforward, if limited,
behavior - easy to understand (but needs to be
documented).  Users can find other ways (e.g.
outside Dired) to take care of such (relatively
corner) cases.

That's unfortunate, but not as unfortunate as the
change you've (apparently) made.

Just one opinion.  Document the limitations, and
leave these two bugs open, hoping that Someone(TM)
at some point will dream up a real, comprehensive
solution.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 25 Apr 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 56 days ago.

Previous Next


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