mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 08:51:14 -03:00
Fix wildcard expansion in directories without read permissions
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
This commit is contained in:
@@ -23,3 +23,15 @@ switch $smurf
|
||||
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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
Test 1 pass
|
||||
Test 2 pass
|
||||
Test 3 pass
|
||||
/tmp/fish_wildcard_permissions_test/noaccess/yesaccess/alpha.txt /tmp/fish_wildcard_permissions_test/noaccess/yesaccess/beta.txt /tmp/fish_wildcard_permissions_test/noaccess/yesaccess/delta.txt
|
||||
|
||||
Reference in New Issue
Block a user