
Case-Insensitive Ext4 - rbanffy
https://lwn.net/Articles/784041/
======
nickcw
Keep that stuff away from my filesystem is my first thought on the matter!

Having had a fair amount of experience dealing with case sensitive, case
insensitive and HFS+ (argh!) file systems in rclone, all I can say is that it
is really hard and much better left to user space. Rclone does syncing between
diverse systems with different ideas about case sensitivity and normalization
when matching up the the source file with the destination file.

I'm not even sure that I agree with normalizing the UTF-8 strings - some users
really care that they have two files which look identical but have different
encoding, for example files with é and é which evaluate to 0x65+0x301 and
0xE9 respectively but look identical.

I might possibly go for filenames having to be valid UTF-8 - that would at
least be consistent with Windows and macOS.

PS I haven't found a way of discovering whether a file system is case
insensitive or case sensitive without creating a file - is it possible?

~~~
cyphar
> I haven't found a way of discovering whether a file system is case
> insensitive or case sensitive without creating a file - is it possible?

You should be able to do ioctl(EXT4_IOC_GETFLAGS) on the directory and check
if EXT4_CASEFOLD_FL is set. I'm not sure if this flag is applied recursively
to child dentries (though I would assume it is).

------
dusted
I can't imagine why anyone would want a case insensitive file system, the
logic makes sense from some abstract humanitarian viewpoint, but it makes no
sense whatsoever that different identities should be mapped/translated to mean
the same..

a.txt != A.txt != a.TXT and so on. They're different names of different files.

Next generation *insensitive behavior should then be that cat.txt and neko.txt
are the same (therefore only one of them allowed).

~~~
trasz
Allowing multiple files with the same file name - differing just by case - is
rather silly from a human point of view.

There are bigger problems, though - currently Linux allows having multiple
files with the exact same file name, differing only by UTF-8 normalisation.

~~~
Flimm
Yes, I would quite like to see Linux filesystems require that file names be in
valid UTF-8, with no new lines, at the very least. Normalisation would be a
bonus but I'd want to do it a way that is helpful for compatibility with macOS
and Windows.

~~~
trasz
There are two ZFS options, “normalization” and “utf8only”, which are
documented to do precisely this
([https://www.freebsd.org/cgi/man.cgi?zfs](https://www.freebsd.org/cgi/man.cgi?zfs)).
Never used it myself, though.

------
cortesoft
A few times I have checked out a git repo on my Mac that had two identically
named files, only differing by case.

Talk about a confusing experience. As soon as you checkout the file, it tells
you that a file has been deleted. All normal git ways of fixing the issue
don't work, because it comes down to the git repo thinking there are two files
but the file system not letting that happen.

~~~
lioeters
I had a couple confusing situations happen in a Git repo, where a capitalized
file name was changed to lowercase, or vice versa.

It caused an issue that only one of us in the team experienced, since they had
a case-insensitive file system, I think Windows. The reverse also happened,
where everyone but that person saw an issue, due to their case-sensitive file
system.

In the end, "git mv" solved those cases, but I never fully understood how to
avoid them occurring in the first place. I think we all just agreed on a
convention of all lowercase folder/file names.

------
pwinnski
One of my NAS units ended up with a case-insensitive filesystem on it at some
point, and I'm too lazy to go through the trouble of changing it. It's pretty
annoying to do `mv filename.that.should.be.in.something.like.proper.case.mkv
Filename.That.Should.Be.In.Something.Like.Proper.Case.mkv` and then realize
that nothing actually changed.[0]

But my mother, case-sensitive filenames on her MacBook would make her life
much worse. She can barely manage the high volume of files she creates as a
teacher as it is, and the potential for accidentally doubling that number, or
worse, is terrifying.

[0] So of course I have an alias `mvd
filename.that.should.be.in.something.like.proper.case.mkv
Filename.That.Should.Be.In.Something.Like.Proper.Case.mkv` that actually does
`mv filename.that.should.be.in.something.like.proper.case.mkv
Filename.That.Should.Be.In.Something.Like.Proper.Case.mkvzzz && mv
Filename.That.Should.Be.In.Something.Like.Proper.Case.mkvzzz
Filename.That.Should.Be.In.Something.Like.Proper.Case.mkv` and all is well.

------
fractalb
Wouldn't it be nice to have a space-insensitive filesystem too? People tend to
insert more than one space between words?

~~~
eptcyka
Yeah, and really, all inputs to open() and co should be piped through a
spellchecker first too.

------
est31
Prior discussion from 3 days ago:
[https://news.ycombinator.com/item?id=24315471](https://news.ycombinator.com/item?id=24315471)

------
smoyer
I was assigned an Apple rMBP in 2012 and ended up installing Linux on it
precisely because you couldn't trust the file system. In my case, I had a
directory with a specific name in lower-case, and without realizing it,
created a file with the same name in Pascal case which then wiped out my
directory full of content. Back-ups are important but they shouldn't be
required simply to rectify stupid OS decisions.

~~~
Fnoord
You can and could set up HFS+ case sensitive and case insensitive. Obviously,
I recommend the former, and I also believe that is the default.

~~~
pseudalopex
Case insensitive is the default.

------
Viliam1234
Case-insensitivity is language-dependent, people know about this, right?

Whether the lowercase version of "I" is "i", that depends on your language.
Often it is, but for example in Turkish, lowercase "I" is "ı", and lowercase
"İ" is "i".

How will the language be specified on the case-sensitive filesystem? Per file,
per directory, per device?

Can I have English "I.txt" and Turkish "i.txt" in the same directory? Are they
compared using the English rules or the Turkish rules?

What happens if I copy a file to a directory or device using a different
language? To a device using a different filesystem that doesn't support
languages? If I copy 10 files from a Turkish computer to a memory stick, then
copy them to an English computer, will I get only 9 files at the end, because
"I.txt" and "i.txt" got overwritten?

~~~
mnw21cam
This one fact is (in my mind) the death-knell of this whole misguided idea.

Also note that once you set up the case sensitivity status on a
directory/device, it could be hard to change it. For instance, if I have two
files named "I.txt" and "i.txt" in a directory that is case-sensitive, I can't
_change_ that directory to case-insensitive using English rules. But I could
using Turkish rules. You would have to do a full scan of the area you are
planning to change in order to check whether anything would clash.

Also, you have the problem of filename searches. At the moment, it is possible
to open a file by name in a directory that has lots of files, and the
filesystem can do an indexed search for that file. If you change it to case-
sensitive, then either you need to do a linear search instead (which could
absolutely cripple some use-cases), or store an indexed case-insensitive
lookup table, with the additional proviso that the index must be able to give
you back the canonical filename. If the case-sensitivity changes, then this
index must be recreated from scratch.

------
tandr
How come Windows, with quirks and all, don't have any problem with this for
like what, 25 years?

(Reading this discussion thread feels like some strange alternative reality
where "take ... from my cold dead hands" is transported to FS world.)

~~~
michaelmrose
If I understand correctly NTFS is actually case sensitive. I believe windows
provided a higher level api that is case insensitive from way back.

[https://docs.microsoft.com/en-
us/windows/win32/api/fileapi/n...](https://docs.microsoft.com/en-
us/windows/win32/api/fileapi/nf-fileapi-createfilea?redirectedfrom=MSDN)

Because everything on windows used the win32 api applications are friendly to
case insensitivity but you can still run into problems interacting with other
systems that are not.

[https://www.hanselman.com/blog/GitIsCasesensitiveAndYourFile...](https://www.hanselman.com/blog/GitIsCasesensitiveAndYourFilesystemMayNotBeWeirdFolderMergingOnWindows.aspx)

------
singularity2001
softer approach: add ``` set completion-ignore-case on ``` in ~/.inputrc

------
RunningDroid
(2019)

