|
|
Log in / Subscribe / Register

Leading spaces are common, actually

Leading spaces are common, actually

Posted Mar 27, 2009 4:41 UTC (Fri) by barryn (subscriber, #5996)
In reply to: Leading spaces are common, actually by njs
Parent article: Wheeler: Fixing Unix/Linux/POSIX Filenames

Behavior of ls in Mac OS X 10.5.6 build 9G55:

$ pwd
/Library/Application Support/GarageBand/Instrument Library/Track Settings
$ ls -l Master | head
total 0
drwxrwxrwx   3 root  admin  102 May  3  2008  Basic
drwxrwxrwx   6 root  admin  204 May  3  2008 Ambient
drwxrwxrwx   6 root  admin  204 May  3  2008 Classical
drwxrwxrwx  11 root  admin  374 May  3  2008 Dance
drwxrwxrwx   5 root  admin  170 May  3  2008 Hip Hop
drwxrwxrwx   5 root  admin  170 May  3  2008 Jazz
drwxrwxrwx   7 root  admin  238 May  3  2008 Pop
drwxrwxrwx   7 root  admin  238 May  3  2008 Rock
drwxrwxrwx   5 root  admin  170 May  3  2008 Stadium Rock
$ 
And this matches the Finder's behavior. BTW, if the Finder behaved any other way, it would be more difficult to properly recover broken Mac OS 9.x or earlier installations using OS X -- Classic Mac OS loads files in /System Folder/Extensions in lexicographic order, and the load order matters, and the leading space trick is used very frequently there. Mac OS X 10.5 can dual-boot with Mac OS 9.x, so this still matters for some users.


to post comments

Leading spaces are common, actually

Posted Mar 27, 2009 15:45 UTC (Fri) by foom (subscriber, #14868) [Link]

>Behavior of ls in Mac OS X 10.5.6 build 9G55

Well, OSX's "ls" is actually just doing a traditional strcmp sort, not anything fancy (note that it puts all uppercase characters before all lowercase).

But the Finder's sort routine is fancy. They seem to be a sort order based on Unicode TR10.

Leading spaces are common, actually

Posted Nov 15, 2009 0:32 UTC (Sun) by yuhong (guest, #57183) [Link]

"Classic Mac OS loads files in /System Folder/Extensions in lexicographic
order, and the load order matters, and the leading space trick is used very
frequently there. "
Yep, look at what they had to do about this when Apple introduced HFS+ in Mac
OS 8.1:
http://developer.apple.com/legacy/mac/library/technotes/t...
s
http://developer.apple.com/legacy/mac/library/technotes/t...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds