Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh expansion fails if nocaseglob and not all directory components are listable

Hi Bert,

Am 22.08.22 um 22:59 schrieb Bart Schaefer:
On Mon, Aug 22, 2022 at 1:15 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:

This behavior is known; see the discussions rooted at workers/47813
(https://www.zsh.org/mla/workers/2021/msg00026.html) and workers/47822
(https://www.zsh.org/mla/workers/2021/msg00035.html), and possibly
others I'm not aware of.  I don't remember if any of the proposed
changes were accepted.

47913: implement CASE_PATHS option to make NO_CASE_GLOB more sensible

This was included in the 5.9 release.

The NEWS file says:

The option CASE_PATHS was added to control how NO_CASE_GLOB behaves.
NO_CASE_GLOB + NO_CASE_PATHS is equivalent to the current NO_CASE_GLOB
behaviour. NO_CASE_GLOB + CASE_PATHS treats only path components that
contain globbing characters as case-insensitive; this behaviour may
yield more predictable results on case-sensitive file systems.
NO_CASE_PATHS is the default.

thanks! And also thanks to all others, I agree (after the examples outlined by Daniel) there is no simple way out, but a new option seems to be the most sensible approach.

Sadly, it does not seem to change the described case, using:
 zsh --version
 zsh 5.9 (x86_64-pc-linux-gnu)
I get:

1) Prepare directory:

mkdir foo
chmod 711 foo
mkdir foo/test
sudo chown root:root foo
cd foo/test

2) Test with caseglob:
setopt caseglob
echo $(pwd)(N)

=> Output is returned just fine.

3) Test with nocaseglob:
setopt nocaseglob
echo $(pwd)(N)

=> No output is returned (expected).

4) Test with nocaseglob and casepaths:
set nocaseglob
set casepaths
echo $(pwd)(N)

=> Also here, no output is returned. The path componend which can not be listed is "foo" which does not have any globbing characters inside.
   I presume it fails since it still attempts to list the directory, which fails, before the actual matching is performed?

Cheers and thanks,

Messages sorted by: Reverse Date, Date, Thread, Author