This article is more than 1 year old
Linus Torvalds fires off angry 'compiler-masturbation' rant
Post starts with 'Christ people. This is just sh*t' and gets angrier from there
Linux Lord Linus Torvalds has unloaded as only he can in a post to the Linux Kernel Mailing List.
At issue is some new networking code that popped up in what was hoped to be the final version of Linux 4.3. Torvalds' first words on the code were:
Christ people. This is just sh*t.
Torvalds is grumpy because some new code has created conflicts. As he put it:
The conflict I get is due to stupid new gcc header file crap. But what makes me upset is that the crap is for completely bogus reasons. This is the old code in net/ipv6/ip6_output.c:
mtu -= hlen + sizeof(struct frag_hdr);
and this is the new "improved" code that uses fancy stuff that wants magical built-in compiler support and has silly wrapper functions for when it doesn't exist:
if (overflow_usub(mtu, hlen + sizeof(struct frag_hdr), &mtu) || mtu <= 7) goto fail_toobig;
and 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. The above code is sh*t, and it generates shit code. It looks bad, and there's no reason for it.
Torvalds offers the following code as his alternative, on the grounds that it uses “... the same number of lines, doesn't use crazy helper functions that nobody knows what they do, and is much more obvious what it actually does.”
if (mtu < hlen + sizeof(struct frag_hdr) + 8) goto fail_toobig; mtu -= hlen + sizeof(struct frag_hdr);
His post goes on to describe the code that angered him as “a shiny function that we have never ever needed anywhere else, and that is just compiler-masturbation." Also: "complete idiotic crap," "anm [sic] idiotic unreadable mess.” Plus: “A f*cking bad excuse for that braindamage.”
The conclusion to the post is blunt:
Get rid of it. And I don't *ever* want to see that shit again.
The rant is entirely impersonal: it rails against code, not people. Those who contributed the offending code will have no doubt of Torvalds' feelings towards it and the open nature of kernel development means it would not be hard to identify those responsible. Torvalds names no names, however. Might that be a nod to those who argue the kernel development community needs to rid itself of personal abuse? ®