mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 18:56:51 +08:00
4621e763b6
When performing wildcard expansion with a literal path segment, instead of enumerating the files in the directory, simply apply the path segment as if we found the directory and continue on. This enables us to expand strings that contain unreadable directory components (common with $HOME) and also improves performance, since we don't waste time enumerating directories unnecessarily. Adds a test too. Fixes #2099
38 lines
738 B
Plaintext
38 lines
738 B
Plaintext
|
|
set smurf green
|
|
|
|
switch $smurf;
|
|
case "*ee*"
|
|
echo Test 1 pass
|
|
case "*"
|
|
echo Test 1 fail
|
|
end;
|
|
|
|
switch $smurf
|
|
case *ee*
|
|
echo Test 2 fail
|
|
case red green blue
|
|
echo Test 2 pass
|
|
case "*"
|
|
echo Test 2 fail
|
|
end
|
|
|
|
switch $smurf
|
|
case cyan magenta yellow
|
|
echo Test 3 fail
|
|
case "?????"
|
|
echo Test 3 pass
|
|
end
|
|
|
|
# Verify that we can do wildcard expansion when we
|
|
# don't have read access to some path components
|
|
# See #2099
|
|
set -l where /tmp/fish_wildcard_permissions_test/noaccess/yesaccess
|
|
mkdir -p $where
|
|
chmod 300 (dirname $where) # no read permissions
|
|
mkdir -p $where
|
|
touch $where/alpha.txt $where/beta.txt $where/delta.txt
|
|
echo $where/*
|
|
chmod 700 (dirname $where) # so we can delete it
|
|
rm -rf /tmp/fish_wildcard_permissions_test
|