News for hackers. Stuff that matters.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by kaolinite on Tuesday January 13, 2015 @11:36AM (#8880832)
There are very real problems with HFS+ related to reliability and data corruption. It really is quite bad. Linus's argument is silly, however, and purely a matter of taste. Case insensitivity certainly isn't the reason that HFS+ is bad.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by debacle on Tuesday January 13, 2015 @12:01PM (#8881024)
I think his argument is that if they weren't using a case-insensitive FS, they could have switched to a better FS long ago.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by jiggy2011 on Tuesday January 13, 2015 @11:41AM (#8880871)
I don't even understand why he doesn't like case insensitivity. I can't think of a reason to have two files with the same name that vary only in capitalisation.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by rogerbinns on Tuesday January 13, 2015 @12:11PM (#8881096)
Are these two names the same case insensitively? Pick and PICK. Hint: https://en.wikipedia.org/wiki/Dotted_and_dotless_I

How about Straße, STRASSE and strasse?

For an American audience, how about Résumé and RESUME and resume?

How about Ⅸ and IX? Hint: https://en.wikipedia.org/wiki/Unicode_equivalence#Normalizat...

The answer to all that is that it depends on the user and their locale settings. So to get this right you would have to pass the locale settings into system calls that go into the filesystem so it can do the right thing on every call. But then what happens if the locale later gets changed? Before some file names may be considered equivalent, but with the new one they are different and things break. Ok how about a system wide locale setting that can't be changed? Are you going to require a disk reformat each time a different user is on the system, or a multilingual user who travels?

The right solution is exactly what Unix did in the first place. The filesystem stores names exactly as is without having to deal with locales. User space is then responsible for doing the right thing for a user. For example a word processor can treat Résumé and Resume as the same for Americans in file selection dialogs.

User space already has to deal with all this, for example by sorting file names. Here is how hard that is http://www.unicode.org/reports/tr10/ and a simple example is if z comes before or after ö. Or when showing a list of Swedish names to a German user do you use Swedish or German sort order?

A similar analogy is dealing with time. The best approach is to store the time as UTC in the filesystem and let user space show it in whatever way is relevant for the user. On the other hand if you store local time in the filesystem, you will end up in a world of hurt trying to work around that. (UTC to local time is a lossy conversion making local time back to UTC hard to work out.)

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by archagon on Tuesday January 13, 2015 @12:55PM (#8881416)
But half the time, I'm having to deal with file access and creation in the terminal. That's as an important user experience to me (a power user) as anything in the GUI. Does Unix change the way the terminal handles files depending on the locale? My understanding is that it does not. (If it did, maybe that would be the best solution for everyone, but I imagine a lot of geeks would be up in arms about how the terminal experience is not consistent...)
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by rogerbinns on Tuesday January 13, 2015 @03:06PM (#8882200)
There are multiple layers at play. For example someone looking a file selection dialog in a gui has at least these layers, lowest level first:

- Filesystem implementation (actual on disk bytes)

- Filesystem compatibility (adjustments to OS semantics)

- Generic filesystem layer in the kernel

- System call interface (between userland and kernel)

- Userland low level library (eg system call wrappers)

- Higher level libraries (eg libc)

- User interface libraries

- App level modules & libraries

The problem with the filesystem being case insensitive is that is the first level above, where there is virtually no context or user information. That is the hardest place to work out if the user considers Résumé and RESUME to be the same. The lower down the list the easier it gets. The important point is that how you store things and how you present does not need to be the same.

Command line tools typically use the libc level of things. It is perfectly possible to make that level so the system appears case insensitive (another poster mentioned Windows doing that).

Your Unix command line experience is very much affected by your locale. For example the ls command does the following:

- Sorts filenames

- Displays sizes (different locales have different conventions for floating point representation, digit grouping etc)

- Displays times

Environment variables like $LANG, $LC_*, $TZ etc control this in Unix.

Individual programs can also alter behaviour. For example bash can be configured to do case insensitive filename completion.

TLDR: while case insensitivity is a nice user experience for humans, it is awful for the lower layers including filesystems. The closer a program is to a human, the easier it is to give that nice user experience. There is no requirement for a case insensitive user experience to then make filesystems also implement that. And as my examples show, they couldn't do it correctly anyway.

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by woodman on Tuesday January 13, 2015 @04:21PM (#8882674)
Don't forget the additional fun that terminal emulators add in the journey from libc to your eyeballs. Some of the most difficult bugs I've worked on involved grep with the color flag and automatic build systems...
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by woodman on Tuesday January 13, 2015 @01:24PM (#8881599)
The terminal is in userland right? So yeah, locale makes a difference based one how the terminal software is designed to handle it.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by tankenmate on Tuesday January 13, 2015 @03:12PM (#8882254)
In that case it isn't the terminal (as a terminal's job is to handle input of text, and output of text). What you need to adjust is your shell; and in the case of bash with file completion it already does equivalencies and ordering correctly for your LANG / LC_* already. Your problem is largely fixed already; it works fine on my case sensitive Linux machine and I am using the default Ubuntu bash settings.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by Afforess on Tuesday January 13, 2015 @11:48AM (#8880927)
Case insensitivity only makes sense dealing with ASCII. Once you allow files and directory names with unicode characters, case insensitivity no longer makes any sense.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by duaneb on Tuesday January 13, 2015 @12:13PM (#8881109)
> Once you allow files and directory names with unicode characters, case insensitivity no longer makes any sense.

I disagree. I don't think a program should make any assumptions about the filesystem namespace—it's up to the user how they want to configure it.

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by chousuke on Tuesday January 13, 2015 @05:04PM (#8882930)
I don't see your point. In every case where you depend on filenames to identify blobs of data, case-sensitivity (actually byte-sensitivity) is the only behaviour that a filesystem can reliably implement. Once you allow cases where two different byte sequences must be considered equal depending on configuration, your filesystem can no longer work reliably.

Case sensitivity may bother users sometimes, but the filesystem is not the right place to solve that problem.

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by Morgawr on Tuesday January 13, 2015 @12:12PM (#8881097)
I always bring this up when people talk about case sensitive/insensitive. Traditionally, a machine only sees the difference in glyphs, not in letters. 'a' is a different glyph to 'A'. We are used to dealing with case sensitivity because that's the most common instance in the English language where we have collision in meaning but not in glyphs.

Let's take other non-latin characters, like accented letters or cyrillic. Some of these alphabets have letters that act as 'a' but are not 'a'. Some of these alphabets have glyphs that look like 'a' but are not 'a'. All of these glyphs are encoded using different codes as seen by a machine.

If you want to support 'a' == 'A', then I could argue that I would want you to support 'a' == 'A' == <letter in cyrillic that means 'a'>. It is a very slippery slope, in my opinion. Logically, I would rather have 'a' and 'A' separated to avoid ambiguity, but feel free to disagree.

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by psadauskas on Tuesday January 13, 2015 @12:01PM (#8881016)
There was a pretty major security flaw in git (and probably numerous other tools) involving case-insensitive filesystems a month ago: https://github.com/blog/1938-vulnerability-announced-update-...

That's a pretty major downside, and I think the back story for his dislike of it.

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by thirsteh on Tuesday January 13, 2015 @11:44AM (#8880891)
I guess his complaint is that lower(str) == lower(ostr) is more code than str == ostr...? :)
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by userbinator on Tuesday January 13, 2015 @11:50AM (#8880941)
A lot more code, if you count the fact that the definition of "case" varies between languages, some of which don't even have such a concept. Add to that Unicode's varying representations that are visually identical but different sequences of bytes, and you have one hell of morass to deal with.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by thirsteh on Tuesday January 13, 2015 @12:09PM (#8881081)
But that's a pretty silly complaint if that's really his argument. Nobody except kernel devs cares if the kernel needs to do case folding when it's 98% a UX issue.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by tankenmate on Tuesday January 13, 2015 @03:15PM (#8882278)
All users care once it, personally, impacts their performance and their security.
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by bunderbunder on Tuesday January 13, 2015 @11:59AM (#8881006)
I think the main complaint would be that it means Linux users will create bugs and security holes if they aren't constantly keeping track of the fact that a huge chunk of the computing world doesn't follow the same convention.

To me it smacks of a rather egregious failure to grasp Postel's law. And case-sensitivity is just bad UX for the 99% of computer users who aren't programmers or IT; perhaps it makes sense on Linux but Windows and OS X are dealing with a different audience and Linus's failure to give that fact some credit makes him come across as tone deaf.

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by dalke on Tuesday January 13, 2015 @12:37PM (#8881288)
MacAdam.doc might be about the American physicist and color scientist David MacAdam.

macadam.doc might be about a type of road construction.

Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by hoggle on Tuesday January 13, 2015 @11:47AM (#8880922)
Yes, I was also hoping he'd be ranting over HFS+ bit-rot: https://news.ycombinator.com/item?id=7876217
Re:Linus Torvalds: Apple's HFS+ is probably the worst file-s... by X-Istence on Tuesday January 13, 2015 @12:13PM (#8881112)
This bit rot is something that applies to almost all older file systems.