News for hackers. Stuff that matters.
Re:Cheating at a company group activity using Unix tools by jrm4 on Monday December 13, 2021 @11:21AM (#29540980)
I really wish people would mostly stop doing this type of utterly and completely necessary "correction." It really misses the point, and exemplifies nearly the exact opposite of the point and value the original article is expressing.

This is a tool used to accomplish a thing, and Unix tools can be used to accomplish things in many different ways. This is like complaining about, I don't know, using a metric-labeled screwdriver on an imperial-measured screw that still gets the job done exactly as needed. Cut it out.

Re:Cheating at a company group activity using Unix tools by DarylZero on Monday December 13, 2021 @11:50AM (#29541311)
> using a metric-labeled screwdriver on an imperial-measured screw that still gets the job done exactly as needed

This is super ignorant. You risk stripping the screw and getting yourself into a frustrating screw extraction job.

Just because you lived, doesn't mean it was safe.

Re:Cheating at a company group activity using Unix tools by jrm4 on Monday December 13, 2021 @12:57PM (#29542210)
Sure, let's beat up this metaphor.

I would say the ignorant one of us is the one who isn't taking into account the nature of the job being done? What makes you think that a) my task is life or death and also b) I'm not equipped to figure out how dangerous it is?

To pull out the camera. I'd like to spread Unix tools to everyone, or at least "more people than use them now." I understand though, for a lot of people, they'd rather gatekeep.

Re:Cheating at a company group activity using Unix tools by DarylZero on Monday December 13, 2021 @02:05PM (#29543062)
It doesn't matter whether it's life or death. If you end up having to extract that screw it's going to be a big headache.

You just shouldn't use an "almost"-fitting screwdriver or wrench.

I'm not trying to "gatekeep." I'm not trying to talk about the shell metaphorically. I'm literally talking about screws.

Re:Cheating at a company group activity using Unix tools by carapace on Monday December 13, 2021 @02:47PM (#29543621)
You picked a bad metaphor, eh?

> The primary cause of this discrepancy was that one piece of ground software supplied by Lockheed Martin produced results in a United States customary unit, contrary to its Software Interface Specification (SIS), while a second system, supplied by NASA, expected those results to be in SI units, in accordance with the SIS.

https://en.wikipedia.org/wiki/Mars_Climate_Orbiter#Cause_of_...

It's hardly gatekeeping to try to teach people better ways to do things.

Re:Cheating at a company group activity using Unix tools by philwelch on Tuesday December 14, 2021 @04:50AM (#29549955)
Comparing the failure of a multi million dollar space probe to a stripped screw head seems like an even worse analogy to me.
Re:Cheating at a company group activity using Unix tools by carapace on Tuesday December 14, 2021 @11:00AM (#29553009)
The moral of the story is "Don't mix metric and imperial." Using that as an example of a trivial thing that shouldn't be corrected is foolish and ignorant. It's practically inviting Murphy.
Re:Cheating at a company group activity using Unix tools by philwelch on Wednesday December 15, 2021 @12:46PM (#29569189)
The moral of the story is “don’t mix units”. It would have been the same problem if the units were inches and feet or meters and kilometers as it is with feet and meters.
Re:Cheating at a company group activity using Unix tools by jrm4 on Monday December 13, 2021 @04:10PM (#29544693)
No, it's a good one. What y'all mistakenly assumed was the idea of "every computer task is a life or death one" instead of considering the idea that there can be different levels of care for different levels of danger.

The reason many people in IT can't think outside of this idea is that they are (subconsciously) reluctant to open the gates for others. As a teacher in IT I quite literally deal with this every day.

Re:Cheating at a company group activity using Unix tools by carapace on Monday December 13, 2021 @05:42PM (#29545646)
I really don't think that teaching people better ways to do things is exclusionary.

The OP even included the reasons why their version is preferable.

You really see that as complaining and gatekeeping? An 'utterly and completely necessary "correction."'?

Re:Cheating at a company group activity using Unix tools by howdydoo on Monday December 13, 2021 @01:13PM (#29542435)
Slightly off topic, but is this something people worry about in the real world? I have about 9 random screwdrivers, and when I need one I just try them all until one seems to fit. And if it doesn't, I... stop, instead of stripping the screw. I couldn't tell you if a single one of them was metric or imperial
Re:Cheating at a company group activity using Unix tools by BenjiWiebe on Tuesday December 14, 2021 @01:29PM (#29555287)
I work on small engines. Their carburetors usually are held together with JIS screws, which do look like Phillips. You can tell if someone took it apart with Phillips, though, as the screw is (basically anyways) visibly damaged and the screwdriver doesn't seat as well.
Re:Cheating at a company group activity using Unix tools by DarylZero on Monday December 13, 2021 @02:09PM (#29543116)
There is no such thing as metric or imperial screw heads. There are various ISO/ANSI standards.
Re:Cheating at a company group activity using Unix tools by jrm4 on Monday December 13, 2021 @04:08PM (#29544661)
:) That's the other thing about my example, it was just a doofy little thing I made up.
Re:Cheating at a company group activity using Unix tools by nicce on Monday December 13, 2021 @12:07PM (#29541565)
It might not miss the point, if the command sample is giving more complicated demonstration than it actually is, almost like doing artificially long command to demonstrate unix-magic, to get more audience.

Anti-patterns are bad, because it usually means that sample command might work in this case, but not in other environments or other use-cases. Someone who is seeing these commands first time, has no idea about that. And this post is meant for beginners.

Re:Cheating at a company group activity using Unix tools by jrm4 on Monday December 13, 2021 @12:54PM (#29542169)
I don't think it's more complicated. Most of the time I see people doing "corrections" on the so-called proper way to use Unix tools, they're favoring conciseness (sure, whatever) over intuitiveness.

I uselessly use "cat" ALL THE TIME, because the Unix pipe metaphor is absolutely intuitively excellent. I know that I'm starting at the beginning with pipe and shoving data through, and I have a good idea about each step.

Re:Cheating at a company group activity using Unix tools by bonkabonka on Monday December 13, 2021 @01:22PM (#29542553)
The original example MUST be corrected for the same reason that folks who post naive code snippets adding SQL strings together with user input must be corrected.

It is not a matter of taste and it is not a matter of metric versus imperial screwdrivers. Someone will copy this code and it will end up being an attack vector where it will have consequences.

I imagine you're rolling your eyes and have flipped the bozo bit but please bear with me.

Think of the teachable moment this presents! The author of the original piece goes back and annotates their original answer along the lines of, "you might solve it this way but there are some gotchas with it - let me show you what could go wrong."

As an industry we absolutely need to circle back with improvements so that those who come after us can build on a more solid foundation.

Re:Cheating at a company group activity using Unix tools by vorador on Monday December 13, 2021 @01:39PM (#29542767)
Genuinely curious, what's so bad about the original code that it adds an attack vector?
Re:Cheating at a company group activity using Unix tools by bonkabonka on Monday December 13, 2021 @05:58PM (#29545805)
To guard against malicious filenames I use `find ... -print0 | xargs -r0...` since posix disallows null bytes (and forward slashes) in filenames. The `-r` flag on xargs means it doesn't execute its command if find matches nothing.

So filenames can contain valid commands delimited with semi-colons that, if not quoted properly, can be unexpectedly run alongside your intended pipeline (say if you're doing the usual and unsafe "for csv in *.csv; do cat $csv; done").

I wish I could've laid my hands on the excellent HN thread from some years back that opened my eyes to this vector, but I'm hopeful someone else will mention it so I can add it to my bash notes file. :P

Re:Cheating at a company group activity using Unix tools by cuu508 on Monday December 13, 2021 @11:40AM (#29541215)
This is pointing out you can simplify the drill+pliers+plunger+screwdriver contraption to just screwdriver.