Do not resolve symlinks and especially hard links and bind mounts for --cwd
and cwd
#2449
Labels
enhancement
New feature or request
fixed-in-nightly
This is (or is assumed to be) fixed in the nightly builds.
Is your feature request related to a problem? Please describe.
A new spawned window, tab or pane will inherit the
cwd
. It can also be supplied directly using the--cwd
option of e. g.wezterm cli spawn
, etc. To support relative paths (see f3a2e84 and #1243), wezterm canonicalizes the cwd. The current implementation does not only resolve relative paths, but also follows symlinks, and even worse, hard links and bind mounts.Resolving symlinks seems questionable, I can imagine plenty of use cases where a user would prefer to work in the symlinked directory and not at the canonicalized path.
However, resolving bind mounts completely breaks with my setup: I am using systemd-homed, which in my case is bind-mounting
/home/$USER.homedir
owned bynobody
to/home/$USER
. Using ID-mapping, the bind-mounted/home/$USER
is mapped to my user ID, such that I can access it. I do not have the rights to access/home/$USER.homedir
, and even if I had, the owner and groups of all files/directories would be wrong. Whenever I open a new tab (or similar), and I am in a subdirectory of my$HOME
, wezterm will redirect me to the/home/$USER.homedir
equivalent, and suddenly I am dropped into a directory which I do not have the rights to access.(Interestingly,
wezterm cli spawn --cwd /home/$USER.homedir/Downloads
will result inERROR wezterm > Permission denied (os error 13); terminating
, butwezterm cli spawn --cwd /home/$USER/Downloads
will happily drop me in/home/$USER.homedir/Downloads
.)Describe the solution you'd like
Wezterm should only resolve relative paths, probably not symlinks, and definitely not hard links and bind mounts.
Describe alternatives you've considered
Maybe resolving symlinks is desired behavior (probably not), and only resolving hard links/bind mounts is undesired.
Additional context
…
The text was updated successfully, but these errors were encountered: