News for hackers. Stuff that matters.
Re:Ubuntu on Windows by Someone on Wednesday March 30, 2016 @07:23PM (#11393795)
"the reality is these tools work just fine. There's never been a reason to evolve them."

On the contrary; there have been many valid reasons to evolve them, but backward compatibility was deemed more important.

Example #1: it is possible to write a sh/csh/bash/?sh script that handles file names with spaces, slashes, quotes, question marks, etc, but one would hope that would be made a bit easier, almost half a century later.

Example #2: the hack that is xargs for handling large numbers of arguments. To write a truly robust script that handles directories with an arbitrary number of files, one should run a pipeline using find and xargs, instructing xargs to do the actual work (and you cannot even use find and xargs with their default settings; you need -print0 and -0 flags to handle file names with spaces, etc)

If programs received arguments unexpanded, and the system had a library for expanding arguments, many use cases would become a lot simpler, and scripts could become more robust.

And yes, that could have been evolved. Headers of executables could easily contain a bit indicating "I'll handle wild-card expansion myself".

Example #3: man pages, IMO, should be stored in a special section inside binaries. That ensures that the man page you read is the man page for the executable you have.

Example #4: http://unix.stackexchange.com/questions/24182/how-to-get-the... shows that things _have_ evolved. Reading and parsing /etc/mtab isn't a reliable way to find all mount points, just as reading /etc/passwd file isn't the way to find password hashes anymore, ar has long been upgraded to support file names longer than 14 characters, and zip knows more file attributes than it used to.

Re:Ubuntu on Windows by seanp2k2 on Wednesday March 30, 2016 @11:46PM (#11394848)
Yeah, it would e.g. Be awesome to standardize all the arguments and flags and even the format of those between all the tools (also: how to define "all the tools"), but it'll never happen due to backwards compatibility / the way people know how to do stuff. As much as these tools are each individually weird and nuanced and stupid and broken, they come together to glue a scary amount of stuff together.

It'll get better through rewrites, new tools, different infrastructures etc long before it gets better through iteration on the same tools. That's OK though :)

Re:Ubuntu on Windows by anthk on Wednesday March 30, 2016 @09:05PM (#11394292)
1) "" or ''

2) Now paralell is better

3) Never. You should be able to check the man pages even if you can't access the binaries.

Re:Ubuntu on Windows by vbernat on Thursday March 31, 2016 @04:06AM (#11395671)
Many shells enable you to change the way word splitting is done. By default, zsh doesn't do word splitting at all for variables.
Re:Ubuntu on Windows by cyphar on Wednesday March 30, 2016 @09:35PM (#11394426)
1. A few minutes of testing will tell you how to do it for every shell script you will ever write. If you can't spare a few minutes, Google it.

2. GNU Parallel is actually my choice for this, because xargs has a few known issues. Parallel gets the most right, and I used it a lot in my research to run scripts on lots of data.

3. Hell no. Distributions do this job perfectly fine, and you should be able to read the man pages without having read permissions for the binary (since in UNIX you can have 111 as permissions on a binary).

Re:Ubuntu on Windows by coldtea on Wednesday March 30, 2016 @10:04PM (#11394539)
>1. A few minutes of testing will tell you how to do it for every shell script you will ever write. If you can't spare a few minutes, Google it.

No, it actually won't. There are so many tricks and caveats with shell expansions, wildcard handling etc, that regularly old unix hats I know get it wrong (and I've started on Sun OS, probably before half of HN was born).

This is like saying "pointers are nothing, you can learn them in a day" ignoring the obvious fact that the interplay with pointers in a large app is something entirely different than merely understanding indirection, and than even the best kernel/driver/crypto/etc programmers still get pointer related bugs after decades of writing C.

>3. Hell no. Distributions do this job perfectly fine, and you should be able to read the man pages without having read permissions for the binary (since in UNIX you can have 111 as permissions on a binary).

Actually, no, they don't do it at all. One can have 3-4 different versions of a userland program, and never know (unless they explicitly check versions) for which the man page is.