Live data from Hacker News

I'm “still afraid to use spaces in file names” years old

twitter.com

371–380 of 817 posts

Re: I'm “still afraid to use spaces in file names” years old

#371

I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by spaces and other unusual characters in file names. If you do anything with subprocesses or path processing, it's absurdly easy to hit in a thousand different ways, over and over again. Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space an…

> Pro tip: rename your development directory

I changed my username to not contain a space because it was too annoying to deal with all the random dev tools breaking. The worst offender was probably npx on Windows [1] (resolved after four years by deprecating npx), but it was far from the only one (though the JS ecosystem was somehow the worst in this regard of all languages I worked with).

1: https://github.com/zkat/npx/issues/100

Re: I'm “still afraid to use spaces in file names” years old

#372
post #25

Looks like I'm in the minority. I always use spaces and non-ASCII characters in filenames. In many languages it's a requirement. For example, in Romanian, there are 8 words that collide with „fata“ if you remove the diacritics (fata, fată, fața, față, făta, făță, fâța, fâță). Given that we have to use diacritics, spaces don't seem like a big deal.

So how did you deal with it in the 80s/90s?

Back in the day there were dozens of character sets that were alternatives to US-ASCII. Having once worked on an Email client, I needed to bake in a bunch of translation tables to convert stuff sent that way into UTF-8.

Re: I'm “still afraid to use spaces in file names” years old

#373

I'm hardly afraid but I just think it's poor ergonomics. Same as the move from xset m 0 0 to xinput --set-prop 'pointer:Logitech USB Receiver' 'libinput Accel Profile Enabled' 0, 1 Everything seems to be going this way in Linux land. Longer names, harder to type names, camelcase names, spaces... I'm looking forward to an OS that treats command line ergonomics as a first class feature and where camelcase & spaces are…

Well, if you think that's bad, behold the recent trend in network interface names on Linux. We started out with 'eth0', 'eth1', etc. Which adapter was which could change when adding and removing a network card. That was bad, so that prompted the evolution. Now we have 'enp1s0', 'enp0s31f6', 'enp13s0' and many similar variations. These are supposedly more stable across device changes. As it turns out, it wasn't. But w…

> These are supposedly more stable across device changes.

No. These are stable across reboots. The old eth? weren't. And yes, that had been a PITA.

Re: I'm “still afraid to use spaces in file names” years old

#374
post #145

Earlier quoted context omitted.

"Path is not a string - it's a sequence of path components and should be treated as such by our APIs." For maximum correctness, you want to turn it into a file handle as soon as possible, and do all operations through the variations of the file functions that end in "at", like: https://linux.die.net/man/2/openat The downside of this approach is that you still technically have to carry the path around with you if you…

This goes for most instances of user input. Timestamps is the other common one people get wrong. I've even seen programs that pass around timestamps as strings in multiple formats and as integers (Unix time).

As a programming noob, I'm wondering what would be the better way to pass or return a unix time value as opposed to an integer?

Re: I'm “still afraid to use spaces in file names” years old

#376

Maybe it's just me, but it always seemed like prohibiting spaces and other special characters was a reasonable way to avoid unnecessary complexity (and the bugs that accompany it) when parsing and navigating directory trees and files. I'm old enough to remember working with 8.3 filenames in DOS, and while the length limitation was maddening, the space part never was. Then Windows 95 came out and all restrictions were…

By coincidence, I found another reason just two days ago. A web app lists uploaded files’ names, and (in a rarely used context) lets the user search for them. One user has copied a file name from the web page, and pasted it into the search box, but got no results. Turned out that the file name contained two consecutive spaces, which the browser turns into a single space, hence no match. Every layer between the user and file system can do something unexpected.

Re: I'm “still afraid to use spaces in file names” years old

#377
post #320

Earlier quoted context omitted.

This is what I want from Linux. Sensible & guessable names for newcomers to figure out where to put files and programs. It's frustrating having to spend time to decide whether I should install a program in /var or /opt or /usr. What do they even mean! So, I disagree with this convention altogether and use /apps or ~/apps now.

Behold! https://en.m.wikipedia.org/wiki/Filesystem_Hierarchy_Standar...

I've read that a handful of times (whenever trying to figure out where to put some new random thing), and still have never come to a clear conclusion. Even better, because there are so many similar places, you might choose completely different ones depending on the day of the week and your current mood.

Too much choice for things like this is harmful IMO. Deep down I truly couldn't care less where the files end up, as long as that place is the 'right' place. There are too many 'right' places which makes it hard to find random things at a later date or when on a box you're not super familiar with. It's also a complete waste of time to think about it at all.

Re: I'm “still afraid to use spaces in file names” years old

#378
It seems to me that many of the problems associated with spaces in filenames are due the OS assuming that a space signals the end of a command or filename.

Maybe we ought have to a different character signify the end of a name? Or signfiy a option section, or the next option section of a command?

Re: I'm “still afraid to use spaces in file names” years old

#379

I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by spaces and other unusual characters in file names. If you do anything with subprocesses or path processing, it's absurdly easy to hit in a thousand different ways, over and over again. Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space an…

My Mac is formatted case sensitive when the default is case insensitive. This will also catch a ton of import related bugs. League of legends doesn’t run until I sed files for instance.

Circa Y2k, I learned that the OSX Palm Pilot software didn't work with case sensitive. I've since given up and stuck with the default. (I'm anti-case folding in general, because of the ambiguity.)

Re: I'm “still afraid to use spaces in file names” years old

#380

Earlier quoted context omitted.

Well, if you think that's bad, behold the recent trend in network interface names on Linux. We started out with 'eth0', 'eth1', etc. Which adapter was which could change when adding and removing a network card. That was bad, so that prompted the evolution. Now we have 'enp1s0', 'enp0s31f6', 'enp13s0' and many similar variations. These are supposedly more stable across device changes. As it turns out, it wasn't. But w…

I was actually ranting about this on IRC last night (yeah now my laptop has two enp* interfaces and enx[MAC]).. One thing I like about OpenBSD is that buses are scanned and drivers probe in order and there's no race between drivers coming up. Unless your hardware is physically tampered with or broken, all interfaces come up with the same name across reboots. Linux isn't like that (even if you don't touch your hardwar…

> add a config file / database entry for each interface the first time is seen.

Ubuntu did that with their persistent-net.rules udev rule. That was a part of the PITA of the old naming.

Post reply on HN