News for hackers. Stuff that matters.
Re:Why was "goto fail;" added without any other change to th... by mistercow on Friday February 28, 2014 @09:51AM (#7318936)
A lot of code editors (Xcode doesn't by default, but you can easily configure it to) have a keyboard shortcut for duplicating the current line. I have plenty of times accidentally made changes at the wrong place in a file because I was mistaken about where the cursor was.

The lesson is to always make sure to look at your diffs before you commit your changes.

Re:Why was "goto fail;" added without any other change to th... by Cthulhu_ on Friday February 28, 2014 @10:03AM (#7319011)
And to have someone else look at your diffs and sign off on them before it's merged into master.

Google / Chrome does this, and so should everyone else, even more so if they're dealing with security.

Re:Why was "goto fail;" added without any other change to th... by mistercow on Friday February 28, 2014 @10:08AM (#7319050)
That's a good measure too, although I think with a mistake like this, the person writing the code might be more likely to spot the mistake than someone else.

It also makes me wonder if the diff display shouldn't have a specific notation for duplicated lines, since they are a special case that can easily be mistaken for a trivial change to a line with the way diffs are typically shown.

Re:Why was "goto fail;" added without any other change to th... by bakhy on Friday February 28, 2014 @11:36AM (#7319769)
Strongly agree with the lesson. I got burned once, produced a security hole by merging a messy config file. The problem was quickly detected, but I have not checked in a single commit after that without first going through all the diffs. Plus, I sometimes notice possible improvements during such a review. It's very helpful.