Subject: bug#29465: 25.3; Confusing message for dired-do-shell-command substitution

From: Eli Zaretskii <[email-masked]>
Date: Tue, 28 Nov 2017 18:26:52 +0200

> From: Allen Li <[email-masked]>
> Date: Tue, 28 Nov 2017 00:25:17 -0800
> Cc: [email-masked], Eli Zaretskii <[email-masked]>, [email-masked]
> 
> Since your commit fixes the inconsistency problem, that's one less
> reason for my advocating to remove the confirmation.  If we can make
> the message less confusing and add an option to disable the prompt, I
> would be happy.

I think clarifying the prompt and adding an option is indeed the way
forward.

> However, I think writing a useful confirmation prompt for this is
> hard; hopefully someone has a good idea.
> 
> One idea would be what Eli suggested:
> 
>   Are you sure you want `*' to be passed to the shell?
> 
> However, what if the command contains both `*' and `?'?

Then the prompt should say that:

   Are you sure you want `*' and `?' to be passed to the shell?

> Since I was not confident that a good message could be written, I
> suggested removing the confirmation.

I think we should try to make the prompt more clear, it cannot be that
hard.  Removing the prompt will introduce backward incompatibility
with what Emacs was doing for the past 15 years, so it's a worse
alternative, IMO.

> Also, I am not sure what this is supposed to be protecting against.
> It seems more useful to confirm when dired-do-shell-command is going
> to replace * or ? rather than when it is not.  If the user did not
> read the documentation string, the user would most likely expect these
> characters to be passed to the shell.  If the user did read the
> documentation string, the prompt would only be an annoyance.
> 
> The original commit by RMS (eab9ed67eb50bab4fc736058a799508d544606a0)
> does not provide a reason for the confirmation.

You need to look up relevant discussions on Emacs mailing lists around
the date of the commit.  In this case, read this thread:

  http://lists.gnu.org/archive/html/emacs-devel/2002-01/msg00233.html

and also the original bug report and its followups:

  http://lists.gnu.org/archive/html/bug-gnu-emacs/2002-01/msg00230.html

> If I were to hazard a guess, the behavior of the command was
> changed, so the prompt was added to warn users accustomed to the old
> behavior.

No, it was a bug report about a potentially risky feature, where a
user mistyping a command could have their files wiped out or cause
some other grave accident.

> However, it is now 15 years since; I don’t think there’s any value
> keeping the confirmation around for its original (?) purpose.

The syntax of the shell commands supported by dired-do-shell-command
and its features regarding '*' and '?' are still very complicated, as
they were back then.  Just the doc string describing the behavior is
so long it can scare.  So I don't see how the time that has passed is
of relevance here.