mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:06:49 +08:00
fish_add_path: Handle moving multiple arguments correctly
This `set -e` had a cartesian product that caused it to remove the indexes separately, so the later indexes were off - removing the first and then the second ends up removing the first and then the old-*third* which is now the second. Just quote the expansion so it runs in one go. Fixes #7776
This commit is contained in:
parent
76457bdc4e
commit
d85bdf120f
|
@ -63,7 +63,7 @@ function fish_add_path --description "Add paths to the PATH"
|
|||
set -l newvar $$var
|
||||
if set -q _flag_move; and set -q indexes[1]
|
||||
# We remove in one step, so the indexes don't move.
|
||||
set -e newvar[$indexes]
|
||||
set -e newvar["$indexes"]
|
||||
end
|
||||
set $mode newvar $newpaths
|
||||
|
||||
|
|
|
@ -54,4 +54,8 @@ fish_add_path -nP $tmpdir/etc | string replace -- $tmpdir ''
|
|||
test "$oldpath" = "$PATH"
|
||||
or echo "PATH CHANGED!!!" >&2
|
||||
|
||||
# See that moving multiple arguments removes the correct ones - #7776
|
||||
PATH=$tmpdir/{bin,etc,link,sbin} fish_add_path -nPpm $tmpdir/{link,sbin} | string replace -a $tmpdir ''
|
||||
# CHECK: set PATH /link /sbin /bin /etc
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user