When expanding a wildcard following a partially quoted pathname,
expansion fails if an intermediate directory is not readable, even when
the final directory (the one in which expansion is performed) is
readable.  This does not occur if quotes are not used in the pathname,
or if the quoted part of the pathname does not cross an unreadable
directory (compare second and third expansions in the commands below).

This does not occur in unpatched bash-5.0.

Test case:

bash-5.0$ mkdir -m700 /tmp/a /tmp/a/b
bash-5.0$ touch /tmp/a/b/c
bash-5.0$ echo /tmp/a/b/* "/tmp/a/"b/* "/tmp/a/b"/*
/tmp/a/b/c /tmp/a/b/c                
bash-5.0$ chmod -r /tmp/a            
bash-5.0$ echo /tmp/a/b/* "/tmp/a/"b/* "/tmp/a/b"/*
/tmp/a/b/c /tmp/a/b/*

Note how the third expansion in the last command fails even though
/tmp/a/b is readable.

  --Andrew Church
    http://achurch.org/

Reply via email to