Subject: bug#66903: 29.1; shell-mode directory tracking incorrectly handles double slashes

From: Visuwesh <[email-masked]>
Date: Sat, 04 Nov 2023 08:23:19 +0530

[வெள்ளி நவம்பர் 03, 2023] Stefan Kangas wrote:

> It would be highly dangerous to start mangling command lines to shells
> run under `M-x shell' in incompatible ways.  Not to mention that such a
> change would be backwards-incompatible.  Consider the command
>
>     sudo rm -rf ~//usr
>
> This is not a contrived example, BTW, but more or less exactly a command
> I have run in the last year.  I don't think I used //, but double
> slashes are always collapsed in POSIX, so I can't be sure.  It's not
> something I look for that when cobbling together shell commands in
> POSIX-compatible shells (bash and zsh here).
>
> So I think we should not do that.

A more common scenario I can think of is output of commands not
sanitising the filenames to change the double slashes to a single slash.
When you copy such a filename from the output to the comint prompt as
part of a command and experience a different behaviour when you send the
command, it would be annoying IMO.  I copy the filename from the output
precisely to avoid typing-and-editing, I don't want to do it more.