this post was submitted on 15 Sep 2025
337 points (98.0% liked)
Linux
58235 readers
880 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Why not parse
ls
(and what to do instead)?The usual problems with parsing
ls
don't happen here because Nu'sls
builtin returns properly typed data. You can work with it in pretty much the same way you would work with it in Python, except that Nu has a composition operator that doesn't suck ass (|
), so you don't have to write as much imperative boilerplate.I have a number of reservations regarding Nu (the stability of the scripting language, unintuitive syntax rules, a disappointing standard library) but this particular argument just doesn't apply.
Isn't that the point that the previous commenter was making by linking that answer? I read their comment as "here is why you should use Nu shell instead of parsing
ls
output."I feel my sanity slowly slipping away while reading...
Yeah, why are linebreaks & co. in names even allowed on file system level? There's not even something like a restricted mode mount option for most fs.
because why not? it's just characters and any UTF8 string is allowed as a filename so long as it doesn't contain a null byte. people's usecases are different, and you really shouldn't be parsing
ls
output in the first placeThere's an argument to be made that system software like filesystems and kernels shouldn't get too smart about validating or transforming strings, because once you start caring about a strings meaning, you can no longer treat it as just a byte sequence and instead need to worry about all the complexities of Unicode code points. "Is this character printable" seems like a simple question but it really isn't.
Now if I were to develop a filesystem from scratch, would I go for the 80% solution of just banning the ASCII newline specifically? Honestly yes, I don't see a downside. But regardless of how much effort is put into it, there will always be edge cases – either filenames that break stuff, or filenames that aren't allowed even though they should be.
Oh right, filesystem is initialized before charset & stuff. My bad.