mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 02:31:18 -03:00
builtin realpath: use absolute path also with -s/--no-symlinks
The old test needs to be changed because $XDG_DATA_HOME can be relative. Fixes #7574
This commit is contained in:
@@ -63,8 +63,8 @@ else
|
||||
end
|
||||
|
||||
# With "-s" the symlink is not resolved.
|
||||
set -l real_path (builtin realpath -s $XDG_DATA_HOME/fish-symlink)
|
||||
set -l expected_real_path "$XDG_DATA_HOME/fish-symlink"
|
||||
set -l real_path (builtin realpath -s $data_home_realpath/fish-symlink)
|
||||
set -l expected_real_path "$data_home_realpath/fish-symlink"
|
||||
if test "$real_path" = "$expected_real_path"
|
||||
echo "fish-symlink handled correctly"
|
||||
# CHECK: fish-symlink handled correctly
|
||||
@@ -72,7 +72,16 @@ else
|
||||
echo "fish-symlink not handled correctly: $real_path != $expected_real_path" >&2
|
||||
end
|
||||
|
||||
test (builtin realpath -s /usr/bin/../) = "/usr"
|
||||
set -l real_path (builtin realpath -s .)
|
||||
set -l expected_real_path (pwd) # Logical working directory.
|
||||
if test "$real_path" = "$expected_real_path"
|
||||
echo "relative path correctly handled"
|
||||
# CHECK: relative path correctly handled
|
||||
else
|
||||
echo "relative path not handled correctly: $real_path != $expected_real_path" >&2
|
||||
end
|
||||
|
||||
test (builtin realpath -s /usr/bin/../) = /usr
|
||||
or echo builtin realpath -s does not resolve .. or resolves symlink wrong
|
||||
|
||||
# A nonexistent file relative to a valid symlink to a directory gets converted.
|
||||
|
||||
Reference in New Issue
Block a user