this post was submitted on 28 Jan 2025
1688 points (99.6% liked)
Programmer Humor
20188 readers
1758 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
What's the use case for case sensitive file names
Well an uppercase ASCII char is a different char than its lowercase counterpart. I would argue that not differentiating between them is an arbitrary rule that doesn't make any sense, and in many cases, is more computationally difficult as it involves more comparisons and string manipulations (converting everything to lower case).
And the result is that you ultimately get files with visually distinct names, that aren't actually treated as distinct, and so there is a disconnect from how we process information and how the computer is doing it.
'A' != 'a', they are just as unequal as 'a' and 'b'
Edit: I would say the use case is exactly the same as programming case sensitivity, characters have meaning and capitalizing them has intent. Casing strategies are immensely prevalent in programming and carry a lot of weight for identifying programmers' intent (properties vs backing fields as an example) similar intent can be shown with file names.
Case insensitive handling protects end-users from doing "bad" things and confusion.
I work with a lot of users and a lot of files in my job.
I don't remember a single case, where someone had an issue because of upper- or lowercase confusions.
Most of my frustration comes from combining cases insensitive folders/files with git and then running my code on another machine. If you aren’t coding where you have hundreds of files that import other files, I could see this being a non issues.
On a Linux environment? Mind sharing the usage area?
Mostly Windows, and construction industry. So projects generate anywhere from a few hundred to up to a hundred thousand files.
Everyone has their own filesystem, and then you often have one formal and multiple informal exchange platforms. You still have people throwing around stuff in E-Mails too.
It is a mess. But in this mess i didn't come acrosse people complaining they couldnt find a file because of the letters case yet.
I see that it could be different for programmers, but i dont see that apples solution of treating upper and lowercase as identical name is the solution there, rather than working with explicit file naming conventions in the program.
Windows is / Windows filesystems are case insensitive too.
Hmm you're right. I didnt notice so far, nor was it brought up as an issue.
You can activate case sensitivity since Win 10 or so.
Like windows and their forbidden folder names
Simple solution: only allow lower case characters in file names.
Me working on a case insensitive DB collation 🤡🚀🐱🏍
If I have four files, a.txt, A.txt, b.txt, and B.txt, in what order do they appear when I sort alphabetically?
edit: I don't understand why this was downvoted?
Might depend on your file browser.
You may also want to try, for example, the files "a1", "a2", "a3", and "a10". Lexicographically, "a2">"a10", but my file browser displays "a10" after "a2".
a, A, b, B?
A computer will spit out A, B, a, b
See also: ASCII chart
So if someone tells me to look for a file amongst a long list, I need to look in two different areas- the uppercase and lowercase areas.
I get why it's more technically correct to differentiate, but from the perspective of a human user, it's a pain in the ass.
I'm with you, and not just from a "human" perspective. Also when writing small programs meant to be relatively lean/simple it can be a problem when the user expects it to find a particular file regardless of its case (will it be
DOOM.WAD
ordoom.wad
?Doom.wad
?Doom.WAD
? ... guess it'll have to be[Dd][Oo][Oo][Mm].[Ww][Aa][Dd]
and import some globbing library as extra dependency... that, or list the whole directory regardless its size andlower
/upper
every single filename until you find a matching one...)Oh jeez, I hadn't even thought about capitalisation in the file extension. That would be especially confusing if extensions are hidden- the user would be presented with two files that look exactly the same.
if you look for a file you type the first letters for the file explorer to jump to the matching name. Retype to jump to the next fitting entry. If you don't know about this, you can put your string in the search field. If you don't know about this, you can sort by metadata like file size or date of last change.
It is a non problem.
Also most workplaces tend to develop a file naming convention, either explicitly or implicitly.
But do I type 'ImportantFile', or 'importantfile'?
As I understand it, if I searched for either of these strings in a case sensitive file system, I would not find a file called 'IMPORTANTFILE'.
At best, a case sensitive file system makes naming conventions more complex. At worst , it obfuscates files. I just can't imagine a scenario where it would be helpful. Do you really see a need to have a file called 'aaaAaa' and a totally separate one called 'aaAaaa'?
The search string is case insensitive. The file name isnt.
So you will find all of them.
But then you are not getting rid of the complexity, you are just forcing programs to become more complex/inefficient.
I experienced this with the doom libretro core, which is meant to be portable and have minimal dependencies... so if I need it to automatically find
DOOM.WAD
/doom.wad
/Doom.WAD
/etc in a directory I would either have to add a globbing library as dependency to handle this case and have it fetch[Dd][Oo][Oo][Mm].[Ww][Aa][Dd]
, manually check for each possible case, or list the entire directory (I hope you don't have a library of a million wads!) and compare each file (afterupper
/lower
) just to find the one with the right name. And that could be a real pain for embedded devices with low I/O or if there's a remote storage layer behind.I think we are looking at this from different angles. I think you are looking at the programmer perspective, and i am looking at the end-user perspective, who uses a GUI file explorer.
In the case of a GUI file explorer the search handles the case insensitivity. So for me using Dolphin in KDE if i have two files:
TEST.txt and test.txt, if i type "tes" on my keyboard, i will be given the uppercase one first. if i type "te" again, it jumps to the next fitting entry, which is test.txt. If i put "test" or "TEST" in the search bar, i will get back both results.
I see why a strictly case insensitive file system makes it easier for programmers down the line to not have to handle the different cases explicitly in their program anymore.
Yes, but you know what I did? nothing, I just have the program exclusively accept lowercase
doom.wad
This means it became annoying for the user. The problem shifted and now it's the end-user the one with the responsibility to read the manual and do the work. A lot of people just get a
DOOM.WAD
, put it there and are surprised it doesn't work.And there are many many programs that are doing the same thing in many similar situations. In fact, in the Linux world, most software pushes this to the end user. So this is just as much of a problem for users as it is for programmers.
At the end of the day, the question should not be: is it more complexity for the user or for the programmer? ..the question should be: what's the end cause making it complex? is there a way it can be made simpler?
This is the same for every problem. Often user-friendliness is a tradeoff, most user-friendly software I've used keeps so much complexity within that it becomes annoyingly slow and inefficient. I'd rather use the terminal for file management than wait for the GUI file browser to finish loading my huge remote storage directories.
Why would you order lowercase before uppercase?
Ascending order implies going from low to high
I guess the problem is that they were thinking First to Last when putting it in this order. Kind of like the image here:
On Mac when I rename a folder from “FOO” to “foo” git sees them as the same folder so no change is committed. In JavaScript I import a file from “foo” so locally that works. Commit my code and someone else pulls in my changes on their machine. But on their machine the folder is still “FOO” so importing from “foo” doesn’t work.
Think the other way around: What's the use case for case insensitive file names? Does it justify the effort and complexity for the filesystem and the programs to know the difference between lower and upper space chars?
Human comprehension.
Readme, readme, README, and ReadMe are not meaningfully different to the average user.
And for dorks like us - oh my god, tab completion, you know I mean Documents, just take the fucking d!
In case you or others reading this don't know: You can set bash's tab-completion to be case-insensitive by putting
Into your .inputrc (or globally /etc/inputrc)
Thank you
For some extra fun, try interop between two systems that treat this differently. Create a SMB share on a Linux host, create a folder named TEST from a Windows client, then make Test, tEst, teSt, tesT, and test. Put a few different files in each folder on the Linux side, then try to manage ANY of it from the Windows client
Because I want to?
Suffering