Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Linux file names

Name: Anonymous 2018-01-29 9:43

You work with a number of linux/unix/whatever tools every day. How many of them break/require special handling when you have file name with spaces?

Name: Anonymous 2018-01-29 10:21

>>1
J-just rename the files

Name: Anonymous 2018-01-29 10:48

>>2
Using mv, a defective tool that was created 35 years ago to handle 35KiB files?

Name: Anonymous 2018-01-29 12:15

>>3
yeah

Name: Anonymous 2018-01-29 12:17

Not too many if you use the current GNU userland. scp has retarded extra rules for spaces though and xargs is as broken as ever.

Name: Anonymous 2018-01-29 14:29

>>3
Why do it manually when you could have two problems instead?

Name: Anonymous 2018-01-29 14:30

None that I remember other than xargs, but lots of tools still have issues with handling filenames that start with a dash.

Name: Anonymous 2018-01-29 14:51

Filenames can't have / in them. That's a bug.

Name: Anonymous 2018-01-29 14:59

>>1
None?

>>3
Works for me.

>>5
Why would you use scp when superior alternatives exist?

>>7
-- exists for a reason.

Name: Anonymous 2018-01-29 15:23

Compare renaming a file with a space in Linux and in Windows XP (last usable Windoze).

Name: Anonymous 2018-01-29 15:29

I fucking hate niggers who feel the need to implement their own broken argument parsers because of muh bloat. Nobody gives a shit if your binary is slightly larger or requires some .so, but they give a shit if your broken garbage can't handle --, doesn't respond to --help or -h and thinks -ass is a single flag.

Name: Anonymous 2018-01-29 16:05

>>11
-ass is a single flag.
Well, it is. Are you dense?

Name: Anonymous 2018-01-29 16:28

>>9
-- exists for a reason.
Not all programs handle that, and I'm pretty sure that counts as "requires special handling".

Name: Anonymous 2018-01-29 16:49

>>12
--ass is a single flag. -ass == -a -s -s

Name: Anonymous 2018-01-29 16:56

>>14
Single letter flags are a terrible idea anyway. If your program needs to be called with flags to work at all, maybe you should split it into separate commands.

Name: Anonymous 2018-01-29 18:01

>>11
they want to feel brilliant without actually doing anything creative or original

Name: Anonymous 2018-01-29 21:36

>>9
And that reason is that the GRAND UNIX HACKERS didn't bother to distinguish between parameters and keywords, so they had to tack more in-band signalling to their in-band signalling. If only -- was at least supported everywhere.

Name: Anonymous 2018-01-30 0:40

>>13
Not all programs handle that
Sure they do.

and I'm pretty sure that counts as "requires special handling".
Doubt it, it is handled by getopt and friends. Heck, implementing it yourself is trivial also, two lines worth of code.

Name: Anonymous 2018-01-30 2:20

>>18
How easy something is to implement doesn't change whether it's special handling.

Name: Anonymous 2018-01-30 6:57

>>1
You work with a number of linux/unix/whatever tools every day. How many of them break/require special handling when you have file name with spaces?

A lot require wrappers, that give input and output files temporary names, then rename them to proper names. I.e. use hardlinks.

Name: Anonymous 2018-01-30 13:52

I love my job because during downtime I can poast shit threads like this one.

Name: Anonymous 2018-01-30 15:06

I love my jobs because during downtime I can acquire dubs

Name: Anonymous 2018-01-31 8:20

>>13,19
Actually, per POSIX, ignoring -- is the special case. Utilities should respect it otherwise specified.

Just use getopt. It's easy as piss. If you can't figure it out, please stop before any innocents fall victim to your incompetence.

>>18
C programmers who don't use getopt should be gassed. There is nothing worse than having to check the source code of somebody's shitty custom parser when it fails.

Name: Anonymous 2018-01-31 8:35

>>23
Getopt is bloated. Just a single switch statement can handle most sub 8chars(uint64_t) switches.

Name: Anonymous 2018-01-31 9:23

>>24
IHBT.

Are you telling me UNIX System III, targeting a PDP-11, in fucking 1980, was bloated? Are you a sock puppet for Cudder by any chance?

getopt is tiny and handles... around SIZE_MAX options per argument. Stop masturbating.

Name: >>25 2018-01-31 9:32

>>24
Further - do you not know that UNIX style single character options can be concatenated into a single argument, in any order? Or are you just being intentionally dense?

In any case, have fun handling all possible permutations in a single switch.

Name: Anonymous 2018-01-31 10:05

>>25,26
FYI you can make a state machine from a for loop, few gotos and a switch.
No need to get bloated.

Name: Anonymous 2018-01-31 10:43

>>27
That's supposed to be less bloated than a compliant getopt? Please, I'd like to see your less bloated command line parsing.

Name: Anonymous 2018-01-31 10:48

>>27
What do you think getopt does? Exactly that, hidden behind a function call, with optional frills for unlikely error cases.

When you consider that every utility on the system is doing the same thing, it's actually less bloated.

Name: Anonymous 2018-01-31 10:54

>>29
unless you're a suckless static linking fanatic

Name: Anonymous 2018-01-31 11:11

>>30
If you care that much about binary size you're already using BusyBox. Which, as it happens, also has getopt.

Name: Anonymous 2018-01-31 14:17

>>30
You can statically link getopt into your program.

Name: Anonymous 2018-01-31 15:13

<- dubs

Name: Anonymous 2018-02-01 9:19

>>27
For loops and goto are bloat though.

Name: Anonymous 2018-02-01 9:37

>>34
map my anus

Don't change these.
Name: Email:
Entire Thread Thread List