Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

U/L case screwup

 
   Macintosh computer (Home) -> General Discussion RSS
Next:  Is Maxtor 120 gig too fast for Blue and White G3?  
Author Message
John Chambers

External


Since: Jul 02, 2003
Posts: 51



(Msg. 1) Posted: Sun Jul 20, 2003 3:11 am
Post subject: U/L case screwup
Archived from groups: comp>sys>mac>misc (more info?)

After a great deal of work, I finally found the source of a bug in a
script that has worked on lots of other unixoid systems. I wrote a
little wrapper around the find command, and called it Find. When I
ran it on OSX, it went berserk, flooding the system with as many find
and sh processes as it could. The tipoff about what was going wrong
was when I added a "which find" command to the script, and it told me
"/Users/jc/sh/find". WTF? There should be no such file; it's called
"/Users/jc/sh/Find". Finally I did this:

: ls -il sh/?ind
343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/Find
: ls -il sh/[Ff]ind
343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/Find
: ls -il sh/Find sh/find
343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/Find
343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/find
:

AHA! File 343724 is singly linked, but it matches both names. A shell
wildcard only finds the "Find", but ls finds both of them, with the same
inode number and only one link. And even worse, when /bin/sh looks for
the "find" command in $PATH, it finds a match with "/Users/jc/sh/Find".

So something somewhere in OSX is doing case-insensitive file matching,
and when my "Find" script tries to run the "find" command, it instead
recursively calls itself.

Is there a fix for this? Can OSX be made to do correct case-sensitive
matching, so that scripts from other systems run the command that they
think they're running?

This is a real showstopper ...

 >> Stay informed about: U/L case screwup 
Back to top
Login to vote
Joe Heimann

External


Since: Jun 28, 2003
Posts: 173



(Msg. 2) Posted: Sun Jul 20, 2003 8:03 pm
Post subject: Re: U/L case screwup [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

John Chambers <jmchambers.DeleteThis@rcn.com> wrote:
 > After a great deal of work, I finally found the source of a bug in a
 > script that has worked on lots of other unixoid systems. I wrote a
 > little wrapper around the find command, and called it Find. When I
 > ran it on OSX, it went berserk, flooding the system with as many find
 > and sh processes as it could. The tipoff about what was going wrong
 > was when I added a "which find" command to the script, and it told me
 > "/Users/jc/sh/find". WTF? There should be no such file; it's called
 > "/Users/jc/sh/Find". Finally I did this:

 > : ls -il sh/?ind
 > 343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/Find
 > : ls -il sh/[Ff]ind
 > 343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/Find
 > : ls -il sh/Find sh/find
 > 343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/Find
 > 343724 -rwxr-xr-x 1 jc staff 350 Jul 19 23:16 sh/find
 > :

 > AHA! File 343724 is singly linked, but it matches both names. A shell
 > wildcard only finds the "Find", but ls finds both of them, with the same
 > inode number and only one link. And even worse, when /bin/sh looks for
 > the "find" command in $PATH, it finds a match with "/Users/jc/sh/Find".

 > So something somewhere in OSX is doing case-insensitive file matching,
 > and when my "Find" script tries to run the "find" command, it instead
 > recursively calls itself.

 > Is there a fix for this? Can OSX be made to do correct case-sensitive
 > matching, so that scripts from other systems run the command that they
 > think they're running?

 > This is a real showstopper ...

OS X does case insensitive matching on a HFS+ filesystem, it is case
preserving only. The only way around this is to use an UFS filesystem,
but that will break a number of Mac OS functions. You would be better
off to rethink your design so as not to depend on case sensitive matches
when using your "Find" for OS X.

Joe Heimann<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: U/L case screwup 
Back to top
Login to vote
John Chambers

External


Since: Jul 02, 2003
Posts: 51



(Msg. 3) Posted: Sun Jul 20, 2003 8:03 pm
Post subject: Re: U/L case screwup [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Joe Heimann wrote:


 >
 > OS X does case insensitive matching on a HFS+ filesystem, it is case
 > preserving only. The only way around this is to use an UFS filesystem,
 > but that will break a number of Mac OS functions. You would be better
 > off to rethink your design so as not to depend on case sensitive matches
 > when using your "Find" for OS X.

That's what I was afraid of. Well, I guess I've got one really serious,
first-level entry in my list of gotchas for OSX. This fact in itself
will suffice to exclude OSX from serious consideration in a couple of
projects that I'm working on.

I wonder how many more surprises like this are lurking in my scripts,
waiting to go berserk N months from now when they get triggered for
the first time? I can't offhand think of any way to do a search for
this problem.

I can probably write a perl script that produces warnings when there
are two things in the search path that differ only by capitalization.
But finding the uses of such things could take a very long time.

Sigh. And OSX did seem to have some nice things ...<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: U/L case screwup 
Back to top
Login to vote
tony

External


Since: Jun 23, 2003
Posts: 38



(Msg. 4) Posted: Sun Jul 20, 2003 10:03 pm
Post subject: Re: U/L case screwup [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

John Chambers <jmchambers.TakeThisOut@rcn.com> wrote:
 >Joe Heimann wrote:


  >>
  >> OS X does case insensitive matching on a HFS+ filesystem, it is case
  >> preserving only. The only way around this is to use an UFS filesystem,
  >> but that will break a number of Mac OS functions. You would be better
  >> off to rethink your design so as not to depend on case sensitive matches
  >> when using your "Find" for OS X.

 >That's what I was afraid of. Well, I guess I've got one really serious,
 >first-level entry in my list of gotchas for OSX. This fact in itself
 >will suffice to exclude OSX from serious consideration in a couple of
 >projects that I'm working on.

That's a FILE SYSTEM issue, not an OS issue. You are perfectly free
not to use HFS+ as noted. The "functions" broken are probably nothing
you care about, or if they are you can keep different data on
appropriate file systems.


 >Sigh. And OSX did seem to have some nice things ...


I'm no fan of this case insensitivity either - I think it was a dumb
thing to do. I understand WHY they felt they had to do it, but
it would be a lot better if you could turn it off at will.

--
tony.TakeThisOut@aplawrence.com Unix/Linux/Mac OS X resources: <a style='text-decoration: underline;' href="http://aplawrence.com" target="_blank">http://aplawrence.com</a>
Get paid for writing about tech: <a style='text-decoration: underline;' href="http://aplawrence.com/publish.html" target="_blank">http://aplawrence.com/publish.html</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: U/L case screwup 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> General Discussion All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]