zsh-workers
 help / color / mirror / code / Atom feed
* Bug report: compinit breaks path resolution in case-insensitive file system
@ 2018-07-29 19:43 Leonardo dos Reis Gama
  2018-08-01  1:18 ` dana
  0 siblings, 1 reply; 2+ messages in thread
From: Leonardo dos Reis Gama @ 2018-07-29 19:43 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug report: compinit breaks path resolution in case-insensitive file system
  2018-07-29 19:43 Bug report: compinit breaks path resolution in case-insensitive file system Leonardo dos Reis Gama
@ 2018-08-01  1:18 ` dana
  0 siblings, 0 replies; 2+ messages in thread
From: dana @ 2018-08-01  1:18 UTC (permalink / raw)
  To: Leonardo dos Reis Gama; +Cc: zsh-workers

On 29 Jul 2018, at 14:43, Leonardo dos Reis Gama <leonardo.reis.gama@gmail.com> wrote:
>% zsh -fc 'cmd'
>b/Cmd
>
>% zsh -fc 'autoload compinit; compinit; cmd'  # this one is broken
>a/cmd

I bet this is a simpler way to replicate the same thing:

  % mkdir a b; for 1 in a/cmd b/Cmd; install /dev/null $1
  % PATH=/tmp/b:/tmp/a /bin/zsh -fc 'cmd; hash -v'
  cmd=/tmp/b/cmd
  % PATH=/tmp/b:/tmp/a /bin/zsh -fc ': $commands; cmd; hash -v'
  Cmd=/tmp/b/Cmd
  cmd=/tmp/a/cmd

I guess something about how the command hash table is already filled in the
second case. compinit will be calling something that has the same effect. I only
looked at it for a second though

dana


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-01  1:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-29 19:43 Bug report: compinit breaks path resolution in case-insensitive file system Leonardo dos Reis Gama
2018-08-01  1:18 ` dana

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).