2024-04-12 18:19:32 +08:00
|
|
|
# RUN: %fish %s
|
2020-01-23 03:46:02 +08:00
|
|
|
|
|
|
|
# Ensure that, if variable expansion results in multiple strings
|
|
|
|
# and one of them fails a glob, that we don't fail the entire expansion.
|
2020-01-31 00:34:48 +08:00
|
|
|
set -l oldpwd (pwd)
|
2020-01-23 03:46:02 +08:00
|
|
|
set dir (mktemp -d)
|
|
|
|
cd $dir
|
|
|
|
mkdir a
|
|
|
|
mkdir b
|
|
|
|
touch ./b/file.txt
|
|
|
|
|
|
|
|
set dirs ./a ./b
|
2020-09-26 17:52:00 +08:00
|
|
|
echo $dirs/*.txt # CHECK: ./b/file.txt
|
2024-01-10 02:06:33 +08:00
|
|
|
echo */foo/
|
|
|
|
# CHECKERR: checks/wildcard.fish (line {{\d+}}): No matches for wildcard '*/foo/'. See `help wildcards-globbing`.
|
|
|
|
# CHECKERR: echo */foo/
|
|
|
|
# CHECKERR: ^~~~~^
|
|
|
|
|
2020-01-23 03:46:02 +08:00
|
|
|
|
2020-01-31 00:34:48 +08:00
|
|
|
cd $oldpwd
|
2020-01-23 03:46:02 +08:00
|
|
|
rm -Rf $dir
|
2020-02-08 17:43:40 +08:00
|
|
|
|
|
|
|
|
2021-03-24 08:26:16 +08:00
|
|
|
# Verify that we can do wildcard expansion when we don't have read access to some path components.
|
2020-02-08 17:43:40 +08:00
|
|
|
# See #2099
|
2021-07-31 08:21:36 +08:00
|
|
|
set -l where ./fish_wildcard_permissions_test/noaccess/yesaccess
|
2020-02-08 17:43:40 +08:00
|
|
|
mkdir -p $where
|
|
|
|
chmod 300 (dirname $where) # no read permissions
|
|
|
|
mkdir -p $where
|
2020-02-15 01:44:54 +08:00
|
|
|
# "__env.fish" here to confirm ordering - #6593.
|
|
|
|
touch $where/alpha.txt $where/beta.txt $where/delta.txt $where/__env.fish
|
2021-07-31 08:21:36 +08:00
|
|
|
echo $where/*
|
|
|
|
#CHECK: ./fish_wildcard_permissions_test/noaccess/yesaccess/__env.fish ./fish_wildcard_permissions_test/noaccess/yesaccess/alpha.txt ./fish_wildcard_permissions_test/noaccess/yesaccess/beta.txt ./fish_wildcard_permissions_test/noaccess/yesaccess/delta.txt
|
2020-02-08 17:43:40 +08:00
|
|
|
chmod 700 (dirname $where) # so we can delete it
|
2021-07-31 08:21:36 +08:00
|
|
|
rm -rf ./fish_wildcard_permissions_test
|