mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-21 06:41:16 -03:00
Always pass in the working directory in path_get_cdpath
If the user is in a directory which has been unlinked, it is possible for the path .. to not exist, relative to the working directory. Always pass in the working directory (potentially virtual) to path_get_cdpath; this ensures we check absolute paths and are immune from issues if the working directory has been unlinked. Also introduce a new function path_normalize_for_cd which normalizes the "join point" of a path and a working directory. This allows us to 'cd' out of a non-existent directory, but not cd into such a directory. Fixes #5341
This commit is contained in:
@@ -809,7 +809,8 @@ parse_execution_result_t parse_execution_context_t::populate_plain_process(
|
||||
!args.try_get_child<g::redirection, 0>()) {
|
||||
// Ok, no arguments or redirections; check to see if the command is a directory.
|
||||
wcstring implicit_cd_path;
|
||||
use_implicit_cd = path_can_be_implicit_cd(cmd, &implicit_cd_path);
|
||||
use_implicit_cd =
|
||||
path_can_be_implicit_cd(cmd, env_get_pwd_slash(), &implicit_cd_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user