News for hackers. Stuff that matters.
Re:Git: Malicious repositories can execute remote code while... by segfaultbuserr on Tuesday March 09, 2021 @05:53PM (#26405556)
Difficult problems in programming:

(1) cache invalidation

(2) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by mattiasfestin on Tuesday March 09, 2021 @05:58PM (#26405620)
The classical three problems.
Re:Git: Malicious repositories can execute remote code while... by xarope on Tuesday March 09, 2021 @06:06PM (#26405692)
I thought the two hardest problems were:

1) naming

2) cache invalidation

...

3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by Ancapistani on Tuesday March 09, 2021 @07:31PM (#26406351)
I'm pretty sure it's:

1) naming

4) concurr2) cache invalidationency

...

3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by hesdeadjim on Tuesday March 09, 2021 @08:21PM (#26406678)
Love this.
Re:Git: Malicious repositories can execute remote code while... by edgyquant on Tuesday March 09, 2021 @10:02PM (#26407258)
You forgot

0) Race consegmentation fault (core dumped)

(I know I was ninja’d but didn’t see until after)

Re:Git: Malicious repositories can execute remote code while... by account42 on Wednesday March 10, 2021 @07:44AM (#26410652)
FWIW, your version has the nice touch of also introducing a 0th item.
Re:Git: Malicious repositories can execute remote code while... by waheoo on Tuesday March 09, 2021 @06:49PM (#26406045)
I feel like we should have solved the naming problem as an industry by now.

Alas.

Re:Git: Malicious repositories can execute remote code while... by layer8 on Tuesday March 09, 2021 @07:24PM (#26406302)
It’s actually the hardest one of the three, being outside the grasp of formal methods.
Re:Git: Malicious repositories can execute remote code while... by kreeben on Wednesday March 10, 2021 @05:30AM (#26409824)
To solve this problem we would need to first understand the human mind, how it stores data, how it does computation, and how it interacts with names. So we would need the same set of information that we would need for creating AGI. A solution is probably only a couple of months/decades away.
Re:Git: Malicious repositories can execute remote code while... by waheoo on Wednesday March 10, 2021 @07:47AM (#26410668)
I really have to disagree, why can't you devise a formal method?

- a good name should be descriptive

- avoid being overly clever, call a spade a spade

- don't optimise for generalisation, naming things is a time to be specific

- aim for short but not at the expense of losing context

- avoid redundancy in naming of things nearby, leverage spatial context

- avoid qualifiers or type information where possible - type should be obvious from context and use, if it's not qualify or refactor

Anything else?

Re:Git: Malicious repositories can execute remote code while... by layer8 on Wednesday March 10, 2021 @07:55PM (#26418746)
Those aren’t formal definitions. “Formal” means, at the very least, that the specification is done in a formal language, and usually that conformance to the specification can be checked mechanically, that is, by a computer.

https://en.m.wikipedia.org/wiki/Formal_methods

Re:Git: Malicious repositories can execute remote code while... by bouncycastle on Tuesday March 09, 2021 @08:26PM (#26406710)
shouldn't your list start from 0?
Re:Git: Malicious repositories can execute remote code while... by gdavisson on Wednesday March 10, 2021 @04:26AM (#26409428)
There are three kinds of programmers:

  1) Those who number lists starting at 1.
  1) Those who number lists starting at 0.
  2.5) Stan Kelly-Bootle, who proposed a compromise.
Re:Git: Malicious repositories can execute remote code while... by edgyquant on Tuesday March 09, 2021 @10:02PM (#26407263)
That’s the joke
Re:Git: Malicious repositories can execute remote code while... by eru on Tuesday March 09, 2021 @11:09PM (#26407659)
Fortunately, many off-by-one errors can be caught with more ergonomic tooling.

For the simplest example: compare the old C-style for loop vs a Python style for-each loop.

Re:Git: Malicious repositories can execute remote code while... by Gene_Parmesan on Wednesday March 10, 2021 @03:29AM (#26409109)
I don't find I ever make off-by-one errors with simple collection iteration; at some point "i < len" becomes tattooed on your brain stem. The off-by-one errors I tend to make are related to implementation details of certain data structures or algs. Really, I would describe them more as "thinking at the margins can be challenging." Correctly handling doubly linked lists, that sort of thing.

Oh, and slicing. I will never get Python slicing right the first time. The fact that the range is [begin, end) is just never the way I expect it to work.

Re:Git: Malicious repositories can execute remote code while... by Ygg2 on Wednesday March 10, 2021 @04:40AM (#26409525)
But slicing 0..len and for (i=0; i< len) are literally the same thing.

In [0, len) ')' means less than. As in 0≤ x< len.

Re:Git: Malicious repositories can execute remote code while... by user-the-name on Wednesday March 10, 2021 @07:10AM (#26410390)
(3) remembering the joke
Re:Git: Malicious repositories can execute remote code while... by echelon on Tuesday March 09, 2021 @06:06PM (#26405693)
Per your downvotes - I used to hate jokes on Hacker News and downvote them when I saw them, but I've become more ambivalent. They're a way of amicably sharing culture and experiences with other engineers that transcend any differences in age, gender, race, background, etc.

The formulation of this joke I tend to see is,

The two hardest problems in programming:

(1) cache invalidation

(2) appropriately naming things

(3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by Twisol on Tuesday March 09, 2021 @06:14PM (#26405748)
It's barely even a joke to me anymore -- it's just too real for me to laugh.

(Cache invalidation is essentially the same problem as managing mutable state -- "Out of the Tar Pit" frames mutable state as either essential or incidental, the latter being rederivable in principle from essential state. Incidental mutable state is no more and no less than a cache, and usually one with an informal and undocumented invalidation policy.)

(And naming things has a very real technical counterpart in addressing, which comes up obviously in networking, but you can also see its shadows in quite a lot of concerns around architecture and modularity.)

Re:Git: Malicious repositories can execute remote code while... by imoverclocked on Tuesday March 09, 2021 @06:43PM (#26405995)
Humor is often the most efficient way to communicate/accept the truth.
Re:Git: Malicious repositories can execute remote code while... by pablius on Tuesday March 09, 2021 @09:36PM (#26407111)
To make the truth seem like an acceptable parallel universe, and then join it.
Re:Git: Malicious repositories can execute remote code while... by JBiserkov on Tuesday March 09, 2021 @07:06PM (#26406173)
The two hardest problems in programming:

(1) cache invalidation

(3) off-by-one errors

(2) appropriately naming things

(4) parallel execution [leading to race conditions / ordering bugs]

Re:Git: Malicious repositories can execute remote code while... by lifeisstillgood on Tuesday March 09, 2021 @07:10PM (#26406205)
I think you win a bad in-joke award - the first annual Turing-Dad joke award.
Re:Git: Malicious repositories can execute remote code while... by rileymat2 on Tuesday March 09, 2021 @07:26PM (#26406311)
Minor quibble, it should be the three hardest problems.
Re:Git: Malicious repositories can execute remote code while... by bluejekyll on Tuesday March 09, 2021 @07:29PM (#26406336)
It should be, but the increments were run in parallel on nonvolatile memory.
Re:Git: Malicious repositories can execute remote code while... by scubbo on Tuesday March 09, 2021 @08:09PM (#26406594)
The two hardest problems in computer science are:

1) Naming 3) Cache Invalidation 2) Off-by-one errors 3) In-order once-only delivery of distributed messages

And an almost fanatical devotion to the Pope

Re:Git: Malicious repositories can execute remote code while... by froh on Tuesday March 09, 2021 @09:21PM (#26407024)
I love it told like this: https://news.ycombinator.com/item?id=26406351

1) naming

4) concurr2) cache invalidation

ency

3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by nicklaf on Tuesday March 09, 2021 @08:51PM (#26406838)
(5) feature creep