From 4621e763b63dd764bc96cc5fe36613b4e0404e6b Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 20 Jun 2015 12:26:03 -0700 Subject: 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 --- tests/test5.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test5.in') diff --git a/tests/test5.in b/tests/test5.in index a3e2256c..1afc0cc7 100644 --- a/tests/test5.in +++ b/tests/test5.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 -- cgit v1.2.3