News for hackers. Stuff that matters.
Re:A brief history of APFS (Apple File System) in honour of ... by ClumsyPilot on Tuesday March 28, 2023 @07:31AM (#35338997)
Do you speak other languages?

Czech language has Á, Č, Ď, Ě, É, Í, Ň, Ó, Ř, Š, Ť, Ů, Ú, Ý

Á can be represented in Unicode by its spesific codepoint, or can be made up of two - Letter A and the squiggly bit.

So when a user tries to fOpen a file called ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ

Should by application make 2^32 requests to the file systen to open a file for every possible combination of bytes this steing could be represented as?

Re:A brief history of APFS (Apple File System) in honour of ... by FeepingCreature on Tuesday March 28, 2023 @08:36AM (#35339884)
To be fair, what a sufficiently clever application could do would be to try and naively open the file, note a mismatch, then do a directory walk comparing normalized filenames.

Still not great.

Re:A brief history of APFS (Apple File System) in honour of ... by flohofwoe on Tuesday March 28, 2023 @09:37AM (#35340836)
Ideally, un-normalized paths wouldn't even make it down to the filesystem layer. I'm just saying that it shouldn't be the filesystem's job to care about text encoding details, but the layers above it (e.g. the filesystem would work in a simple "garbage in - garbage out" mode).
Re:A brief history of APFS (Apple File System) in honour of ... by flohofwoe on Tuesday March 28, 2023 @09:31AM (#35340761)
I speak German which has its share of pointy letters :)

I'm aware of the normalization problem, but that should be handled in the API layers above the filesystem. In which layer exactly is up for discussion though (but IMHO there should always be a fallback to access files via their "raw bytes path identifiers", if for nothing else than debugging).

Re:A brief history of APFS (Apple File System) in honour of ... by sacnoradhq on Wednesday March 29, 2023 @12:22AM (#35352510)
Yes. Separate concerns and group logic where the knowledge and configuration to handle it for the use exist closer to the application, not scatter it throughout the system stack that shouldn't need to know anything above it.

The main ways of finding files are by enumeration and filtering on that enumeration. Normalization should selectively occur during filtering rather than permanently destroying the original bytes of the name of the file. Without a binary-precise filename call to open() (fopen() is a library call, not a syscall), then case-folding and Unicode normalization shouldn't second-guess the request or help the program. Case-insensitive filesystems are industry nonstandard and a dumb choice Apple continues to use.

Re:A brief history of APFS (Apple File System) in honour of ... by Wicher on Tuesday March 28, 2023 @05:14PM (#35347966)
At this point the user will discover that easy to type unambiguously encoded filenames have value, and may opt to save the Á's for when they actually are writing a letter to grandma.

"But that's subjecting the user to limitations of the system!" you might object, and while you'd be right we should also ponder whether a filesystem is a word processor or a system for locating data using filenames as identifiers, and consequently, what sound handling of identifiers is.

And let's be realistic. Most users will choose the file to open from a file picker dialog. fopen() is not their interface, their interface is a file picker.

The intersection of people for whom fopen() is their interface (no file pickers) but for whom learning lessons on the value of using unambiguous identifiers is somehow out of reach, would be exceedingly small.

Re:A brief history of APFS (Apple File System) in honour of ... by hibbelig on Wednesday March 29, 2023 @10:02AM (#35357427)
> At this point the user will discover that easy to type unambiguously encoded filenames have value, and may opt to save the Á's for when they actually are writing a letter to grandma.

The unambiguously encoded filenames wouldn't be in the natural language of the user, so you're asking the user to learn another language. Users shouldn't have to learn another language to use the computer.

Re:A brief history of APFS (Apple File System) in honour of ... by Wicher on Wednesday March 29, 2023 @11:12AM (#35358424)
I'm not 100% sure on this, but in many/most/all scripts, wouldn't there be a subset of characters in unicode for which you don't need to worry about unicode ambiguities with respect to combining characters?

For prose of course it wouldn't be acceptable if you can't use your full language, but this is a filesystem, and we're talking identifiers, not prose. We accept that for a wide range of everyday things — I don't think many people are getting worked up about web forms not accepting their phone numbers when entered in Latin numerals.

Using bytestring labels sans normalization is just the rational choice, and actually quite accommodating. People _can_ use their natural language. If you can encode your prose in bytes, then there you go, that'll be your filename ;-) and if you can't remember what diacritic-combining strategy you used when you created the file, and can't manage to fopen() it anymore by typing out the filename, use a file picker or search. And then, perhaps, go "that was a hassle, I'll avoid those fu͝n͜n͏y͝ sq̧u͜igg̶l̢įȩş for my next filename, computer are stupid" - not the end of the world, not the worst outcome.

Re:A brief history of APFS (Apple File System) in honour of ... by hibbelig on Wednesday March 29, 2023 @02:21PM (#35361147)
I'm not 100% certain, either. Hasn't someone else here written that all of the Korean characters can be expressed in two ways?

Then there is Vietnamese which has a lot of accents and other diacritics. Not sure how much you can do without them.

Perhaps a language like Chinese doesn't have so many ambiguities, as in there is only one way to encode a given character in Unicode?