Linus meltdown on a Git pull
lkml.iu.edu
lkml.iu.edu
-------------
Linus’s Rant RE-Rewritten
This is the old code in net/ipv6/ip6_output.c:
mtu -= hlen + sizeof(struct frag_hdr);
and this your replacement: if (overflow_usub(mtu, hlen + sizeof(struct frag_hdr), &mtu) || mtu <= 7)
goto fail_toobig;
The problem is that the overflow_usub() function is non-standard and requires special compiler support to generate reasonably efficient code. That function hasn't been used anywhere else in the code base before. Also, the code uses two conditionals. Here is how it should have been written: if (mtu < hlen + sizeof(struct frag_hdr) + 8)
goto fail_toobig;
mtu -= hlen + sizeof(struct frag_hdr);
It takes the same number of lines, doesn't need a little-known helper function, is clearer in its intent and is easier to read. There could still be overflow issues if the "hlen + xyz" expression overflows, but the "overflow_usub()" code has that same problem.Also, we are near to rc7 time, and we don't want conflicts at this point.
Thank you for submitting the code, but, for all the aforementioned reasons, I have to reject it and will do so for similar code in the future.
Those aren't weasel words, that's direct feedback.
The rewritten message clearly indicates a rejection of the submitted code, so directing the submitter to consider the example replacement seems a constructive and appropriate response.
The rewritten version neglects the criticism that the submitted code is too fiddly relying on the short-circuit of the || operator, but Linus failed to mention that as well :p
Deleted comment
Linus isn't just talking to the submitter. He knows perfectly well that his rants will be read by everyone in the community. A polite "plz fix it" will go unnoticed.
I'm not sure whether there's some common understanding that his rants are just an act, to get everyone to read them. Or if Linus thinks that it's actually justified to be a dick when people fuck up. But I think it's a factor - when Linus rants, everyone pays attention, and Linus will certainly be aware of that.
Yes, it would be nice if people paid attention to him being polite. But if he wrote it like the rewritten suggestion, only a handful of people would read it, and they're probably not the the type of people who are making the mistakes to begin with.
If people ask Linus to do anything, ask him to politely reach out to the people he flames, and let them know that the reason for his grandstanding is mostly just to grab eyeballs. It raises an important issue, and while he may be annoyed at the bad submit the level of vitriol is only really there to grab attention.
Imagine if all tech managers in behaves like him, I think most of us would be in other industries.
For example, why something as simple as 'git pull' has had so much confusion and discussion. Why there are millions of views on S.O. on just the differences between pull and fetch?
http://stackoverflow.com/questions/292357/what-are-the-diffe... ==> Viewed: 1080104 times
Good code doesn't just pass unit tests. It should be know-able, think-able, make some level of sense and generally be easily understandable.
I think it has to do with the fact that a lot of developers are taught that abstraction/indirection are good things (and to a certain extent, they are), and can be used to manage complexity; but not that they're more of a last-resort option compared to actually making the design as simple as possible.
Linus' rant about "helper functions" reminds me of a time when I taught an intro programming course and helped a student who, when faced with not knowing how to solve a problem, decided to take "write a helper function" as his mantra (apparently he read that somewhere in a book) and ended up with around a dozen-level-deep nested set of functions that turned out not to do anything useful at all - each one just called another and returned its result, except the deepest one, which he came to ask me about. He thought that the solution would somehow come to him more easily the more "abstract" (in his terms) the code became, and went steadfastly down that path - until common sense took over and he came to me wondering what he did and why it didn't work.
Linus is doing what he needs to do to keep everyone in their place. Some of these programmers don't like taking no for an answer. I've been that guy before. I've been a real butthead to people with my code. So I respect what Linus is doing. Because I had it coming, and so did the recipient of this rant.
>> Get rid of it. And I don't ever want to see that shit again.
> I don't want to give up on that this easily
Is Mauro still contributing to the Linux kernel?
http://lkml.iu.edu/hypermail/linux/kernel/1510.3/03200.html
From: Rasmus Villemoes
Date: Wed Oct 28 2015 - 10:30:41 EST
On Wed, Oct 28 2015, Hannes Frederic Sowa <hannes@xxxxxxxxxxxxxxxxxxx> wrote:
> Hi Linus,
>
> On Wed, Oct 28, 2015, at 10:39, Linus Torvalds wrote:
>> Get rid of it. And I don't *ever* want to see that shit again.
>
> I don't want to give up on that this easily:
>
> In future I would like to see an interface like this. It is often hard
> to do correct overflow/wrap-around tests and it would be great if there
> are helper functions which could easily and without a lot of thinking be
> used by people to remove those problems from the kernel.
I agree - proper overflow checking can be really hard. Quick, assuming a
and b have the same unsigned integer type, is 'a+b<a' sufficient to
check overflow? Of course not (hint: promotion rules). And as you say,
it gets even more complicated for signed types.
A few months ago I tried posting a complete set of fallbacks for older
compilers (https://lkml.org/lkml/2015/7/19/358), but nothing really
happened. Now I know where Linus stands, so I guess I can just delete
that branch.
Rasmus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/Please don't ever manage people. Thanks.
I think when you hire someone the least you can expect from them is to not cuss out a co-worker for a mistake.
In spite of the tone and language, Torvalds manages to keep the issue fairly impersonal (The reference to 'braindamage' sort of crosses the line). Nowhere does he specifically call any specific individual out, even though he easily could with git blame on the specific line as well as grabbing the author, committer(s), and reviewers (individuals responsible for signing off the commit) information from git log.
Still, if my code received that sort of treatment, I would probably be in tears.
I think the reason Linus feels justified in being an asshole is that he feels you can't accidentally write code this way. Rather, he thinks it's someone trying to make themselves look smart at the expense of the project, which is itself assholish behavior. I'm not saying he's right, but if you look at it from his perspective it's at least logically consistent.
http://lkml.iu.edu/hypermail/linux/kernel/1510.3/02919.html
meh, it's just another day at lkml, not a meltdown.
Linus"
And this is why Linux dominates practically all computing platforms everywhere.
if (overflow_usub(mtu, hlen + sizeof(struct frag_hdr), &mtu) || mtu <= 7)
goto fail_toobig;
Any code which relies on the short-circuiting behavior of a logical operator in such an obscure way is bad code. Linus may have gone a bit overboard in his critique, but, again, it was almost all criticism of the code, not the person. The only criticism of people is him calling people who like that code "out to lunch".In short, I'm not seeing a meltdown.
https://en.wikipedia.org/wiki/Short-circuit_evaluation#Commo...
What is obscure about it? I hate to think about how even more verbose C would be without short-circuiting. Now if there had been a side effect... well, it would still be debatable - but at least you'd have a watered down cert recommendation to point to.
...anybody who thinks that the above is
(a) legible
(b) efficient (even with the magical compiler support)
(c) particularly safe
is just incompetent
If that isn't a criticism of the person, I don't know what is.I'm all for not pulling in useless broken code, but why the public rant?
The second part of cleverness is in fact even more damning than that. The conditional || mtu <= 7 is a siren's call for anyone looking for a cheap optimization. To someone not paying attention, this looks like it could be a nice patch -- take out an or that couldn't possibly be true under any circumstance, and save a few ops on every incoming packet. Bundle it in with other optimizations, and you've got an overflow just waiting to go off.
So no, it's not bikeshedding, it's being too clever for one's own good, and in one line adds a new function call that's just barely been proposed for a standardized version of C, and has a pair of logic errors to boot. In short, ticking off pretty much everything you don't want to do in a line of code.
Also it's cathartic.
I don't have much tolerance for Linus like behavior in places that I work day-to-day though, without a lot of protective social niceties.
David wrote about it here, https://signalvnoise.com/posts/1214-profanity-works
This is the Linux kernel, it runs the world.
http://lkml.iu.edu/hypermail/linux/kernel/1510.3/02919.html
I would imagine that if you're is being flamed by linus on lkml, it is most likely because you messed up big-time. Don't expect to be reprimanded with sugar coating. More so if you are an adult/mature/experienced (in terms of contributions) person who should've known better.
...anybody who thinks that the above is
(a) legible
(b) efficient (even with the magical compiler support)
(c) particularly safe
is just incompetent and out to lunch.I wasn't immediately sure if it's Linus doing the bike shedding- In fact it appears to me more like the PR is the culprit.
Also: Linus rarely insults people, he criticizes the code, albeit harshly. http://blog.codinghorror.com/egoless-programming-you-are-not...
Self censoring the swear words - how civil :D
Asserting dominance with aggressive behavior is fine I guess (with in boundaries) - it makes calling out someone much more powerful but at the same time makes you look like a tool if you're wrong and you lose respect faster - double edged sword.