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

Bug report: compinit breaks path resolution in case-insensitive file system



I'm on macOS High Sierra (10.13.6) with a case-insensitive HFS+ file
system. The behaviour observed is identical with either the system's zsh
(/bin/zsh) of version 5.3 or the Homebrew's zsh (/usr/local/bin/zsh) of
version 5.5.1. Steps to reproduce:

1) Create two executable scripts with the same name but different cases as
follows

/tmp/a/cmd:
#!/bin/zsh
print a/cmd

/tmp/b/Cmd:
#!/bin/zsh
print b/Cmd

(Note the uppercase 'C' in the second file name)

2) Set PATH:

% PATH='/tmp/b:/tmp/a:/bin'

3) Run the following commands:

% zsh -fc 'cmd'
> b/Cmd

% zsh -fc 'autoload compinit; compinit; cmd'  # this one is broken
> a/cmd

% zsh -fc 'autoload compinit; compinit; rehash; cmd'  # this trick doesn't
work when my rc files are loaded
> b/Cmd

% zsh -fc 'cmd; autoload compinit; compinit; cmd'
> b/Cmd
> b/Cmd

% zsh -fc 'cmd; rehash; autoload compinit; compinit; cmd'  # broken again
> b/Cmd
> a/cmd

% zsh -fc 'cmd; rehash; autoload compinit; compinit; rehash; cmd'
> b/Cmd
> b/cmd

Note: I know that case-insensitive file systems are broken by design and
it's not an absolute zsh fault. My specific problem was fixed by simply
renaming the "/tmp/b/Cmd" file to "/tmp/b/cmd", but I thought it would be
nice to report the issue even then. Hope it helps! ;)

Thank you for your attention.

Leonardo Gama
[image: https://]about.me/leogama
<https://about.me/leogama>


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