Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Case Sensitivity Bug?
- X-seq: zsh-workers 26139
- From: "Sean B. Palmer" <sean@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Case Sensitivity Bug?
- Date: Tue, 16 Dec 2008 14:14:03 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=kQ9WFRBopl8YGqjvKwXu4PCgmZyoWPcb8CLTHfvSJNg=; b=D+g9jrZ3x8Du61cxvmSJpezblshcomUqtpO7LIvoCLs7GpoiqEOutkNprIiWLR19r/ 3Q8ToDnTqHhr6MgAdGVsqe1H/as6M5a1AdVcWWUHBlpisoJe0BCCww5mOKUlqd7SAN76 xyfCA1y7VD2a2N1Em1O67qQnwKtkHRtc+/Oqc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=XxoxQ5fkwiy/SKFi6yXglAFmXuYlTUoYL2xpqrEjUnB1NG9XCH2lmNyfsjlCjE7Ft5 vnBvU51fieiayRjpCBJEa0spz30SmdazjPRD/htBFFtqf7tYIv8cwBlhocQIqY6Xkg58 nlxRLHbepC6+L8yU8IRNEC9pXji5hUUf8ZlBI=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: sean.b.palmer@xxxxxxxxxxxxxx
zsh is doing something very strange on OS X:
$ zsh -c 'echo test; which head'
test
/opt/local/bin/head
$ zsh -c 'date; which head'
Tue Dec 16 13:57:00 GMT 2008
/usr/bin/head
The problem centres around the case-sensitivity of HFS+, the OS X
filesystem. I have two head binaries, one called "head", the standard
unix head, and one called "HEAD", part of perl's lwp library:
$ which head
/usr/bin/head
$ which HEAD
/opt/local/bin/HEAD
As you can see from the echo and date commands, my problem is that
invoking echo first in the shell (or invoking nothing at all) causes
which to work in a case insensitive manner. When date is invoked first
instead, which works in a case sensitive manner.
Why is this so? And how does zsh manage to implement a case sensitive
which at all? Neither sh and bash on OS X have a case sensitive which.
I'm using OS X 10.4.11 (Tiger).
The #zsh channel on Freenode suggested I try using -x for extra
diagnostics, but that didn't help. Someone else asked me to check
$PATH to see if it was modified before or after any command; it is
not. In fact, the whole ENV seems static, so I don't think it's any
ENV related problem.
Some more information that might help you to help me:
$ zsh -c 'echo $ZSH_VERSION'
4.2.3
$ zsh -c 'which head'
/opt/local/bin/head
$ zsh -c 'which HEAD'
/opt/local/bin/HEAD
$ zsh -c 'time echo test; which head'
test
/opt/local/bin/head
$ zsh -c 'time date; which head'
Tue Dec 16 14:02:17 GMT 2008
real 0.008s
user 0.001s
sys 0.004s
cpu 64%
/usr/bin/head
$ zsh -c 'cd ..; which head'
/opt/local/bin/head
$ zsh -c 'ls -ald .; which head'
drwxr-xr-x 196 sbp sbp 6664 Dec 15 21:36 .
/usr/bin/head
The pattern seems to be that any builtin invocation before which means
that which behaves case insensitively. When a non-builtin is invoked,
then which behaves case sensitively. The sensitivity only depends on
the very first invocation:
$ zsh -c 'which head; date; which head'
/opt/local/bin/head
Tue Dec 16 14:04:52 GMT 2008
/opt/local/bin/head
The context of this bug report is the following thread on MacPorts:
https://trac.macports.org/ticket/17620
As you can see, there's some debate there as to what is *right*;
whether which should or should not be case sensitive on OS X. The main
question for me is how which manages to be case sensitive at all,
since obviously I want to continue using both my head and HEAD
binaries in the normal manner, as I have been doing.
(My .zshrc includes a call to "date", and I don't tend to use any
other shell, so I've never noticed the case sensitivity problem before
until it came up with python_select in this MacPorts bug.)
In other words, if zsh can be case sensitive on OS X then so,
presumably, can MacPorts using the same mechanism. This will fix my
python_select bug more satisfactorily than having to remove the "HEAD"
binary.
Thanks,
--
Sean B. Palmer, http://inamidst.com/sbp/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author