News for hackers. Stuff that matters.
Re:Docker for Windows won't run if Razer Synapse driver mana... by kstenerud on Tuesday February 18, 2020 @04:52AM (#22354732)
> homework assignment for all programmers reading this thread: Think about how you'd find this bug in your own programs. You copy/paste the code, it seems to work, and you don't realize it's broken because you don't run either of these programs which made the same mistake.

Wait... WHAT??

Who the hell copy pastes code into their program without first examining and understanding what each step is actually doing, how and why the pieces fit together as they do, and how it works as a whole to solve the problem?

Re:Docker for Windows won't run if Razer Synapse driver mana... by coldtea on Tuesday February 18, 2020 @06:28AM (#22355153)
>Who the hell copy pastes code into their program without first examining and understanding what each step is actually doing, how and why the pieces fit together as they do, and how it works as a whole to solve the problem?

Almost everybody at some point or another?

Re:Docker for Windows won't run if Razer Synapse driver mana... by cstuder on Tuesday February 18, 2020 @05:30AM (#22354918)
Say hello to `pasteoverflow`: Paste code from Stackoverflow directly into your editor.

https://marketplace.visualstudio.com/items?itemName=matsz.pa...

Re:Docker for Windows won't run if Razer Synapse driver mana... by maest on Tuesday February 18, 2020 @06:20PM (#22361489)
Reminds me of this beauty: https://gkoberger.github.io/stacksort/
Re:Docker for Windows won't run if Razer Synapse driver mana... by XCSme on Tuesday February 18, 2020 @07:44AM (#22355551)
Please stop :(
Re:Docker for Windows won't run if Razer Synapse driver mana... by mperdoni on Tuesday February 18, 2020 @11:33AM (#22357209)
Can it go one meme-step further and automate our jobs away? ;)
Re:Docker for Windows won't run if Razer Synapse driver mana... by stmL on Wednesday February 19, 2020 @07:55AM (#22365007)
Re:Docker for Windows won't run if Razer Synapse driver mana... by meddlepal on Tuesday February 18, 2020 @09:15AM (#22356168)
I used to work with a "senior developer" that was making well over 150K several years ago that basically just verbatim copy-pasted code off StackOverflow and hacked it together.

He got shit done and that was what mattered to his bosses... of course it was all a steaming pile of unmaintainable garbage but that didn't matter to anyone.

If he couldn't find it on Stackoverflow he would ask another developer who would tell him how to do it... then Mr Senior Developer would ask that other developer if he could just "send him the code".

Last I heard he's still at that company and still making bank doing nothing but copying and pasting other people's work.

Re:Docker for Windows won't run if Razer Synapse driver mana... by chrisoverzero on Tuesday February 18, 2020 @08:49AM (#22356013)
>Who the hell copy pastes code into their program without […]

The developers of Docker for Windows and the Razor Synapse driver management tool. Among others.

Re:Docker for Windows won't run if Razer Synapse driver mana... by ghostpepper on Tuesday February 18, 2020 @05:30PM (#22361096)
Heh, I read your comment after I posted almost the same thing word for word.
Re:Docker for Windows won't run if Razer Synapse driver mana... by tinus_hn on Tuesday February 18, 2020 @05:33AM (#22354936)
> Who the hell copy pastes code into their program without first examining and understanding what each step is actually doing

The people who write the software that runs the airplane you’re on.

Re:Docker for Windows won't run if Razer Synapse driver mana... by viraptor on Tuesday February 18, 2020 @05:46AM (#22354997)
If you haven't seen stacksort yet: https://gkoberger.github.io/stacksort/
Re:Docker for Windows won't run if Razer Synapse driver mana... by raxxorrax on Tuesday February 18, 2020 @06:15AM (#22355110)
Well... laziness is the mother of invention or something like that.

Has anyone about 40 lines of code with an average line width of 80 characters? I have this rather spare region that doesn't look nice on the mini map.

But seriously, I think the reasons are mundane and developers often have an ample list of problems to solve, so easy solutions for some of those are used as much as possible. Ensuring only one process runs at a time is probably just a feature that invites negligence.

It shouldn't happen, but I am not surprised.

Re:Docker for Windows won't run if Razer Synapse driver mana... by mperdoni on Tuesday February 18, 2020 @11:01AM (#22356958)
There seems to be a suspicious rise of acceptance for this "practice". It's very concerning. I've never found a SO answer to be copyable, they are usually wrong or flawed.

Usually have to dig in all the responses to get a balanced overview, then apply those concept(s) to your problem at hand....

Re:Docker for Windows won't run if Razer Synapse driver mana... by bloopernova on Tuesday February 18, 2020 @10:06AM (#22356531)
I know a coworker whose cloudformation code I have had to fix multiple times because they've done just that. Googled "how to do $problem" then skimmed over the first result and copied the code from it.

It's been raised with management, and nothing has been done about it.

Re:Docker for Windows won't run if Razer Synapse driver mana... by mcv on Tuesday February 18, 2020 @05:35AM (#22354944)
> "Who the hell copy pastes code into their program without first examining..."

Quite a lot of people do that. It's pretty much the reputation of Stackoverflow. And of course everybody knows it's bad, but it saves time and it works and there's deadlines so they move on and ship it to production.

How to find this particular bug is not that hard, though: you're looking for a way to ensure that your program can run only once, so you use that mutex. But you want to be sure that mutex is unique to your program and not shared with others that use the same method, so you create another program that uses the same method and test if they conflict. If they do, then your mutex is not unique to your program.

Re:Docker for Windows won't run if Razer Synapse driver mana... by JeremyNT on Tuesday February 18, 2020 @11:16AM (#22357078)
> Quite a lot of people do that. It's pretty much the reputation of Stackoverflow. And of course everybody knows it's bad, but it saves time and it works and there's deadlines so they move on and ship it to production.

The trick of it is, it's only "bad" if you care about code quality and/or maintainability, fuzzy attributes which are seldom measured or optimized for. It's the only logical conclusion to "move fast and break things."

p.s. - the good news is, most of us are working on software that doesn't really matter terribly much, so the fact that it's bad also doesn't matter very much

Re:Docker for Windows won't run if Razer Synapse driver mana... by viraptor on Tuesday February 18, 2020 @05:51AM (#22355016)
> If they do, then your mutex is not unique to your program.

Unfortunately, if they don't, you only know that there exists one program which does collide with your app's mutex. Nothing more, nothing less.

> But you want to be sure that mutex is unique to your program

This one's actually impossible to test. Or to be pedantic, we know it can't be done - another app can be using your app's guid for its mutex, but in realistic cases, it's just really hard to test for. There could be even a real use case for collision - independent agents walking the process tree and relying on locks based on guids to not step on each other.

Re:Docker for Windows won't run if Razer Synapse driver mana... by mcv on Tuesday February 18, 2020 @07:13AM (#22355361)
It's not a true proof that it's unique, but if you have two programs use the same method to generate that GUID and end up with different GUIDs, while different instances of the same program get the same one, it's looking pretty likely that they're unique to the program. Going beyond that is only really interesting to mathematicians.
Re:Docker for Windows won't run if Razer Synapse driver mana... by _pmf_ on Tuesday February 18, 2020 @06:18AM (#22355123)
I've had exactly zero instances where I could copy and paste literally.
Re:Docker for Windows won't run if Razer Synapse driver mana... by _rrnv on Tuesday February 18, 2020 @04:57AM (#22354757)
you forgot to add /sarcasm
Re:Docker for Windows won't run if Razer Synapse driver mana... by Havoc on Tuesday February 18, 2020 @07:57AM (#22355644)
>Who the hell copy pastes code into their program without first

Millions upon millions of people learning via googling

But yeah hopefully not in production & ideally sandboxed

Re:Docker for Windows won't run if Razer Synapse driver mana... by ghostpepper on Tuesday February 18, 2020 @05:29PM (#22361088)
Developers at Docker and Razer, among others.
Re:Docker for Windows won't run if Razer Synapse driver mana... by asynch8 on Tuesday February 18, 2020 @08:24AM (#22355835)
honestly, i think it would be easier to count the people that DO read every thing line of code they copy
Re:Docker for Windows won't run if Razer Synapse driver mana... by P_I_Staker on Tuesday February 18, 2020 @07:36PM (#22361949)
Lots of people, sadly