mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
fix: use string check to determine if filename is a fish file; fix #459
Bug was introduced in 7850f78e8a
.
When removing a file don't use `functions -q $filename` as a loose
check for a .fish file. Use a string match instead.
`functions -q $filename` will cause the function defined in the file
to be autoloaded (if it wasn't already) which can cause trouble with
some "dubious" packages that run arbitrary code in function files.
This commit is contained in:
parent
60d3c4c9c3
commit
2a6c36b8a9
1 changed files with 3 additions and 9 deletions
12
fisher.fish
12
fisher.fish
|
@ -324,16 +324,13 @@ function _fisher_pkg_uninstall -a pkg
|
||||||
set -l filename (echo "$target" | command sed 's|.fish||')
|
set -l filename (echo "$target" | command sed 's|.fish||')
|
||||||
switch $source
|
switch $source
|
||||||
case $pkg/conf.d\*
|
case $pkg/conf.d\*
|
||||||
if test "$filename.fish" = "$target"
|
test "$filename.fish" = "$target"; and emit "$filename"_uninstall
|
||||||
emit "$filename"_uninstall
|
|
||||||
end
|
|
||||||
set target conf.d/$target
|
set target conf.d/$target
|
||||||
case $pkg/completions\*
|
case $pkg/completions\*
|
||||||
if functions -q "$filename"
|
test "$filename.fish" = "$target"; and complete -ec $filename
|
||||||
complete -ec $filename
|
|
||||||
end
|
|
||||||
set target completions/$target
|
set target completions/$target
|
||||||
case $pkg/{,functions}\*
|
case $pkg/{,functions}\*
|
||||||
|
test "$filename.fish" = "$target"; and functions -e $filename
|
||||||
switch $target
|
switch $target
|
||||||
case uninstall.fish
|
case uninstall.fish
|
||||||
source $source
|
source $source
|
||||||
|
@ -343,9 +340,6 @@ function _fisher_pkg_uninstall -a pkg
|
||||||
case \*
|
case \*
|
||||||
set target functions/$target
|
set target functions/$target
|
||||||
end
|
end
|
||||||
if functions -q "$filename"
|
|
||||||
functions -e $filename
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
command rm -f $fisher_path/$target
|
command rm -f $fisher_path/$target
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue