Live data from Hacker News

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

twitter.com

481–490 of 817 posts

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

#481
post #162

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 (or even better: the workspace path in CI) to put a space and/or special characters in it. A former co-worker changed his name in our auth system to include an apostrophe, so that whenever we handled names wrong he'd find it.

To have such thoughtful coworkers. On an old team I had two coworkers named Chris and once in a blue moon when they reviewed each other code master would start crashing because one of them accidentally left in an absolute path starting with "/home/chris/".

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

#482

Earlier quoted context omitted.

I was thinking January 11th vs November 1st. Maybe their "date" doesn't need/support day-of-month? Or they typod and I should just focus on my work.

I imagine January is A and November is K, so 21A11 vs. 21K1 (or maybe 21K01).

Ah yes, I missed that K was a month.

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

#483
post #435

Earlier quoted context omitted.

Overly aggresive is right! I don't know if this is genius or deranged! I'm leaning towards genius and stealing the idea. By the way: what's your beef with en dashes? I mean, if it was "everything should be 'HYPHEN-MINUS' (U+002D)", then fine, but why specifically en dashes and not em dashes?

> By the way: what's your beef with en dashes? Of all the changes in that list, removing the character that doesn't appear on a standard keyboard seems like the least controversial...

To add, it's a character that gets magically inserted for no reason in various situations.

It's up there with those damn angled quotes.

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

#484
post #307

Earlier quoted context omitted.

I mean we're heading there with /usr being your /System. Redhat/Pottering are doing heroic work in this space. /Users -> /home /System -> /usr /Data -> /var /Config -> /etc /Boot -> /boot /Ephemeral Temp -> /run /Persistent Temp -> /tmp The only real holdouts are proc/sys/dev which are the kernel and mnt/media/opt/srv which are really for the user/sysadmin and aren't really used by the OS anymore.

Genuine question: on what systems is `/tmp` persistent? Both macOS and Ubuntu 20.04 clear `/tmp` on every reboot for me, and I haven't changed the defaults at all.

All storage is temporary. You just gotta wait long enough.

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

#485
post #472
post #411

I have an overly-aggressive function in my .bashrc to rename all files in the current directory: # Rename all files in a directory rn() { rename "s/ /-/g" * rename "s/_/-/g" * rename "s/–/-/g" * rename "s/://g" * rename "s/\(//g" * rename "s/\)//g" * rename "s/\[//g" * rename "s/\]//g" * rename 's/"//g' * rename "s/'//g" * rename "s/,//g" * rename "y/A-Z/a-z/" * rename "s/---/--/g" * rename "s/-‎--/--/g" * } I use th…

Word of warning from hard experience: rn is a really dangerous thing to name a function because it is one char away from rm.

ren would be better than rn. :)

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

#487
post #307

Earlier quoted context omitted.

I mean we're heading there with /usr being your /System. Redhat/Pottering are doing heroic work in this space. /Users -> /home /System -> /usr /Data -> /var /Config -> /etc /Boot -> /boot /Ephemeral Temp -> /run /Persistent Temp -> /tmp The only real holdouts are proc/sys/dev which are the kernel and mnt/media/opt/srv which are really for the user/sysadmin and aren't really used by the OS anymore.

Genuine question: on what systems is `/tmp` persistent? Both macOS and Ubuntu 20.04 clear `/tmp` on every reboot for me, and I haven't changed the defaults at all.

People don't reboot often. Persistent tmp basically means it will be cleared in an infrequent manner, so the likelihood of it going away 1s after you release your file handle is low.

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

#488

Earlier quoted context omitted.

Yeah, except that tells me nothing useful... The question is exactly the same: So where do I install this random binary I downloaded from the internet or compiled myself? Is it /opt, /usr/bin, /usr/local/bin, or /bin? Where do I put the dependencies I compiled for this software - /usr/lib, /usr/local/lib, /lib, /opt/lib, /opt/ /lib, or what?

Is your account the only account that's expected to run the binary? If so, then `$HOME/bin` is a perfectly acceptable (albeit not standard) place to put it. If you expect other users to be able to execute the program, then you should put it in either `/usr/bin` or `/usr/local/bin`, depending on whether the former is already being used by a package manager. `/opt` is generally for self-contained software that doesn't…

$HOME/.local is the equivalent if /usr/local for per-user stuff.

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

#489

Earlier quoted context omitted.

Yeah, except that tells me nothing useful... The question is exactly the same: So where do I install this random binary I downloaded from the internet or compiled myself? Is it /opt, /usr/bin, /usr/local/bin, or /bin? Where do I put the dependencies I compiled for this software - /usr/lib, /usr/local/lib, /lib, /opt/lib, /opt/ /lib, or what?

Is your account the only account that's expected to run the binary? If so, then `$HOME/bin` is a perfectly acceptable (albeit not standard) place to put it. If you expect other users to be able to execute the program, then you should put it in either `/usr/bin` or `/usr/local/bin`, depending on whether the former is already being used by a package manager. `/opt` is generally for self-contained software that doesn't…

I started out using $HOME/bin, but a fair amount of stuff assumes a /usr- or /usr/local-style folder structure when doing make install, so I've settled on using $HOME/usr/bin instead, so that programs can create $HOME/usr/include and $HOME/usr/share and whatever, without trampling on stuff in my home folder.

Can't remember the last time I had a problem arranging this. If using autotools, which covers 95+% of stuff, it's usually a question of something like "./configure --prefix=$HOME/usr".

(If I want to share stuff between users, /usr/local/ is of course a better place. macOS is a bit more restrictive, so I have a separate user for this, whose /usr folder is readable by everybody.)

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

#490

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.

I also enjoyed doing that, but had to make a DMG just for Steam because it straight-up refuses to run on a case sensitive FS (that's true on Windows, also, which I suspect is how we all got here). I think the most recent Steam versions either caught wind of my trickery or -- more likely -- run something from $HOME/Library/SomethingOrOther and thus the work-around it no longer works

When I got a new Mac, I just gave up and acquiesced to the case-retentive world :-(

Post reply on HN