mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-27 16:51:15 -03:00
builtin cd: print error about broken symlinks
When cd is passed a broken symlink, this changes the error message from
"no such directory" to "broken symbolic link". This scenario probably
won't happen very often since completion won't suggest broken symlinks
but it can't hurt to give a good error.
Fish used to do this until 7ac5932. This logic used to be in
path_get_cdpath, however, that is only used for highlighting, so we
don't need error messages there. Changing cd is enough.
Reword from "rotten" to "broken" since that's what file(1) uses.
Clean-up leftovers from old "rotten" code (nomen est omen).
See #8264
This commit is contained in:
@@ -233,3 +233,27 @@ cd ""
|
||||
# CHECKERR: called on line {{\d+}} of file {{.*}}/cd.fish
|
||||
echo $status
|
||||
# CHECK: 1
|
||||
|
||||
ln -s no/such/directory broken-symbolic-link
|
||||
begin
|
||||
set -lx CDPATH
|
||||
cd broken-symbolic-link
|
||||
end
|
||||
# CHECKERR: cd: '{{.*}}/broken-symbolic-link' is a broken symbolic link to 'no/such/directory'
|
||||
# CHECKERR: {{.*}}/cd.fish (line {{\d+}}):
|
||||
# CHECKERR: builtin cd $argv
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: in function 'cd' with arguments 'broken-symbolic-link'
|
||||
# CHECKERR: called on line {{\d+}} of file {{.*}}/cd.fish
|
||||
|
||||
# Make sure that "broken symlink" is reported over "no such file or directory".
|
||||
begin
|
||||
set -lx CDPATH other
|
||||
cd broken-symbolic-link
|
||||
end
|
||||
# CHECKERR: cd: '{{.*}}/broken-symbolic-link' is a broken symbolic link to 'no/such/directory'
|
||||
# CHECKERR: {{.*}}/cd.fish (line {{\d+}}):
|
||||
# CHECKERR: builtin cd $argv
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: in function 'cd' with arguments 'broken-symbolic-link'
|
||||
# CHECKERR: called on line {{\d+}} of file {{.*}}/cd.fish
|
||||
|
||||
Reference in New Issue
Block a user