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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 03 Nov 2023 09:15:59 +0200

severity 66903 wishlist
thanks

> From: Allen Li <[email-masked]>
> Date: Thu, 2 Nov 2023 17:14:36 -0700
> 
> (assume ~/bin exists)
> 
> 1. M-x shell RET
> 2. cd ~//bin RET
> 3. M-: default-directory RET
> 
> Expected:
> 
> default-directory is ~/bin
> 
> Actual:
> 
> default-directory is /bin

This is the standard Emacs behavior: double slash makes everything
before that ignored.

> It seems like the directory tracker uses Emacs's convention for double
> slashes "resetting" a path to root, but most shells treat double slashes
> the same as single slashes.

"M-x shell" is not a shell, it is an Emacs interface to a shell.
Thus, it should be free to implement behavior not present in the
shell, if we consider it convenient for Emacs users.

> It looks like this should be fixed in `shell-cd` (which should also fix
> `shell-process-pushd`) by implementing "custom" path handling (compared
> to Emacs default path handling behavior).

This is not a bug.  I'm okay with adding a new optional feature that
would disable the above behavior, but it must be off by default.