back to article Linus Torvalds fires off angry 'compiler-masturbation' rant

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 …

Page:

  1. Rol

    He's blunt. He's aggressive. He's offensive.

    He's right.

    And thank heavens he still cares enough about his baby to kick ass when needed.

    1. Lee D Silver badge

      Re: He's blunt. He's aggressive. He's offensive.

      He's not corporate either, he has no need to be polite.

      In professional atmospheres, I've witnessed a whole lot worse than "what is this shit?". Privately, I've heard even high-end corporate types use such languages in private meetings - they are only more polite for fear of some HR-comeback if they're not. In everyday personal life, I sure give such verdicts on crap that I'm forced to use.

      I'm more interested in why anyone thinks this is worthy of an article. "Elite software developer gets pissed off at crap software code foisted upon him".

      What gets me is that a few messages later is a re-pull request without that code - so it's entirely unnecessary, unjustified and only creeped in (if the new pull request is to be believed) because nobody commented on it when it was posted to the usual mailing lists. This is a heads-up to his maintainers, and the people posting patches, and those reviewing patches. "We don't do this".

      And guess what? I bet nobody's going to try pushing that shit into the kernel again.

      1. Naselus

        Re: He's blunt. He's aggressive. He's offensive.

        "I'm more interested in why anyone thinks this is worthy of an article. "Elite software developer gets pissed off at crap software code foisted upon him"."

        I suspect the 'newsworthy' part of this is actually how restrained Linus was in his rant this time. After all, nothing caught fire and women and children didn't run screaming.

    2. Chika
      Linux

      Re: He's blunt. He's aggressive. He's offensive.

      If some of the people behind this code weren't such doofuses, then maybe he wouldn't have to be.

      Go for the jugular, LT!!!

    3. The Tea Lady
      Unhappy

      Re: He's blunt. He's aggressive. He's offensive.

      It's small wonder that GNU/Linux is going the way of the Blackberry! It's run by people who act like little children! Nay, worse than children.

      Incivility is rarely appropriate and never constructive. Much better ways exist to get one's point across, without resorting to such tawdriness! And anyone defending such antics deserves equal blame.

      Besides, in a few years, GNU/Linux will go the way of the Blackberry. And small wonder, that.

      1. Paul Smith

        Re: He's blunt. He's aggressive. He's offensive.

        For example ?

      2. Amorous Cowherder
        Stop

        Re: He's blunt. He's aggressive. He's offensive.

        "Incivility is rarely appropriate and never constructive. "

        Oh shut up! Yes, I do agree but sometimes you have to vent, clear the air make people aware of your emotions THEN most of us will apologise and get the thing fixed.

        Sorry but despite us have having this noble air of civility, we're all just monkeys with technology. The killer instinct is just below the surface in every single one of us and it's only the brainwashing we get in our familie, schools and social circles that helps us to keep it under control. Once in a while it bursts out, we break something, shout and scream and then we get back to normal.

        1. BillG
          Pirate

          Re: He's blunt. He's aggressive. He's offensive.

          Sorry but despite us have having this noble air of civility, we're all just monkeys with technology. The killer instinct is just below the surface in every single one of us and it's only the brainwashing we get in our familie, schools and social circles that helps us to keep it under control. Once in a while it bursts out, we break something, shout and scream and then we get back to normal.

          Although I don't like what you wrote, I'm forced to agree with it.

        2. Anonymous Coward
          Anonymous Coward

          Re: He's blunt. He's aggressive. He's offensive.

          Yes, I see your point, I slapped a couple bitches around and then killed their boy friends but now I feeling fine again, boys will be boys ;)

      3. JustNiz

        Re: He's blunt. He's aggressive. He's offensive.

        You "politically correct at all cost" types make me wanna puke. How is this incivil? he's insulting the code no the author. The code IS crap and he's pointed that out with the force it requires to nip it in the bud and stop some moron copying that approach again later.

      4. JustNiz

        Re: He's blunt. He's aggressive. He's offensive.

        >> It's small wonder that GNU/Linux is going the way of the Blackberry!

        Wow how uniformed can you be? You need to go get a clue.

        Guess what OS over 99% of the worlds 500 top supercomputers run? Guess what OS is the parent of what most of the world's smartphones run? Guess what OS Google and most of the other servers on the internet run? Guess what OS your own home networking gear is probably running?

        1. sansmojo

          Re: He's blunt. He's aggressive. He's offensive.

          Blackberry? ;)

      5. ro55mo

        Re: He's blunt. He's aggressive. He's offensive.

        It's open source development. Licensed under GNU GPL. Pray tell how it can go the way of Blackberry? It is not even a company...

        Sure other people have formed companies which have created products based Linux like Redhat, VMware and Canonical to name few.

      6. Dolapevich

        Re: He's blunt. He's aggressive. He's offensive.

        I... can't imagine why you would say this.

        You are not only comparing apples with cyclotrons, which doesn't make any sense, but also giving no clue of why you do it.

      7. Anonymous Coward
        Anonymous Coward

        Re: He's blunt. He's aggressive. He's offensive.

        > in a few years, GNU/Linux will go the way of the Blackberry

        And replaced by what?

    4. JDX Gold badge

      Re: He's right.

      Sometimes he's right, sometimes it's subjective personal opinion.

    5. Christian Berger

      Yes, but it may be one of the few cases of him being wrong

      There's a rather good argument that he's wrong. Essentially using the compiler built-in function is more efficient and in a way more readable as everybody understands what this code is about. (checking for an overflow)

      Overflows are one of the hard parts of C(++/#) and even Java.

      Here is the full argument by someone who professionally finds integer overflows:

      http://blog.fefe.de/?ts=a8c95274 (In German of course, this is about computing after all)

      1. Michael Wojcik Silver badge

        Re: Yes, but it may be one of the few cases of him being wrong

        There's a rather good argument that he's wrong.

        I don't think it's a zero-sum game in this case. The code he's complaining about is not particularly readable; I'm with him on that. And using language extensions is suspect, in my book, but then I've never been fond of Gnu's "almost but not entirely unlike C" language.

        On the other hand, his proposed alternative, while very clear, duplicates the addition and so risks skew - in a future edit, someone might change one line but miss the other.

        The broader point, that checking for over/underflow in C is a pain in the ass and easy to get wrong, and at best makes the code more verbose and harder to read, is well-taken. This is one of the real problems with C: making it safer is possible, but expensive both for the author of the code and anyone reading it later (and some studies put reading and understanding code at as much as 40% of the overall cost of typical software development).

      2. gnasher729 Silver badge

        Re: Yes, but it may be one of the few cases of him being wrong

        Linus' code is straightforward and obvious for any decent C or C++ developer. The code using macros is unreadable and trivial to get wrong, because it relies on knownledge written elsewhere.

        1. bazza Silver badge

          Re: Yes, but it may be one of the few cases of him being wrong

          Ironically no one seems to be checking for overflow of:

          hlen + sizeof(struct frag_hdr)

  2. John Tserkezis

    Beats the shit that's beaten into Microsoft software people "Make money at all cost! Make money at all cost!"

    1. Anonymous Coward
      Anonymous Coward

      beaten into Microsoft software people "Make money at all cost!

      Well, Windows 10 says the beatings didn't work.

      I've no doubt that if MS had been taken private by somebody like Silverlake (a private equity outfit focussed on IT for those not familiar) then W10 would have been very different, would have been a winner, and we'd (happily) have been reaching for our wallets because no way on this planet would it have been free.

      Maybe I'm alone on that, but on balance I would have payed for W10 if it had worked. So a choice of a pure tiles'n'apps or W7 menus according to my choice, ideally some new whizzy tech to justify the price (that is, not crapware like Cortana), no spyware, better security (including a complete ban on security ground-zeroes like Flash) and all for a cost of around thirty quid.

      But Microsoft don't see this. W10 will be rammed down our throats (and when pressure doesn't work, they'll just end-of-life W8 to force us), but speaking for myself, I can smell a couple of things. One is the smell of decay (I thing somewhere Redmond way), and the other thing I can smell is mint. Linux Mint. I'm not there yet, but Microsoft are pushing and pushing, and eventually my patience will give way. I just needed to replace a domestic laptop, and I've ordered a Chromebook. I know that's Google spyware, but the point is that it's the first non-Microsoft computer in this household in nigh on thirty years.

      1. Anonymous Coward
        Anonymous Coward

        Where I work, we have a department exactly like that. Good thing that the mortgage is paid off soon.

      2. PaulFrederick

        Mint is not the highest quality Linux distribution. So don't judge all of Linux by Mint if you ever end up running it. Although Mint has a lot of features that do make it new user friendly. Mint is akin to your first bicycle with training wheels on it. Once you get your balance you might want to try out a distribution with a more mature orientation. By then you'll know which to choose.

        Now as far as spyware goes everyone is spying on your as soon as you access the web. So I don't know how much Google spying on your some more really matters. Have a cookie.

    2. JDX Gold badge

      MS spends huge amounts of money reviewing their code. Their process is FAR more rigorous than some angry git personally checking all the code ;)

      1. JustNiz

        Yes they do ...and in spite of that, Windows is still undeniably more insecure than Linux and much more of a shit product generally too.

        1. Siv

          I think this tired argument about Windows being "undeniably insecure" is wearing thin.

          In reality Windows is now pretty secure, sure it was insecure 10 years ago, but now as each vulnerability has been patched the malware writers are having to attack things like Java and Flash as it's increasingly difficult to attack Windows itself.

          The old claims about FOSS being inherently secure because it is open and that means more eyes were able to look over the code has been debunked lately. I am thinking of the likes of OpenSSH/Heartbleed and TrueCrypt and the number of viruses that are appearing on Android.

          The truth is, (shock horror), that whilst few end users were using Linux and thus it was not worth the malware writers attention it seemed secure. Now that finally it's going mainstream in its Android form and there are substantial amounts of end users with Bank Accounts to hack, suddenly we are seeing the true facts that Linux like Windows is written by mere mortals and there are just as many bugs as Windows had.

          1. Oldbear

            In reality Windows is still pretty insecure, check the US_CERT database. Firmly holds the record for score 10 vulnerabilities. Closely followed by IE. Adobe is lagging behind...

      2. PaulFrederick

        Judging by performance data apparently whatever Microsoft is doing isn't working well for them. That angry git even wrote Git in his free time.Git is another project Linus was the founder of.

    3. dogged

      > Beats the shit that's beaten into Microsoft software people "Make money at all cost! Make money at all cost!"

      Oh, do you work for them?

  3. Mugs

    Good to see GOTO is still cool.

    1. Anonymous Coward
      Anonymous Coward

      GOTO is fine in very select circumstances. i.e. (and the forum code will make a mess of indentation here)

      int init_structure(struct my_structure** s)

      {

      int ret = 0;

      *s = malloc(sizeof(struct my_structure));

      if (!(*s)) {

      ret = errno;

      goto exit_init;

      }

      *s->substructure = malloc(sizeof(struct another_structure));

      if ((*s)->substructure) {

      ret = errno;

      goto exit_init;

      }

      free(*s);

      *s = NULL;

      exit_init:

      return ret

      }

      Yes, that GOTO could be factored out quite easily in this situation, but suppose you had not one, but three or four sub-structures to allocate? Then an IF-based solution becomes messy. GOTO actually works out clearer to understand. Easy to read code is easy to debug code. There's no spaghetti here!

      What's not okay is jumping between labels in other functions or using it to replace if, while and for statements. The C language has things like setjmp and longjmp for doing exactly this, and it's one feature that to my mind is just asking for trouble, so I never use that feature. That's what leads to a big tangled mess that no one can understand.

      1. Anonymous Coward
        Anonymous Coward

        setjmp and longjmp are essentially the C version of exception handling and save doing if-then checks on returns of nested functions. But they're really only for use when things are really in a mess and unrecoverable - as exceptions should be used rather than as a general function return method which is what seems to happen in C++ rather too often due to poorly written libraries and ignorant coders.

      2. This post has been deleted by its author

        1. This post has been deleted by its author

          1. Anonymous Coward
            Anonymous Coward

            @Vic is correct, OP is leaking.

            The code jumps to the error path when substructure *is* allocated, then it frees the parent, leaking, substructure.

            if ((*s)->substructure) {

            goto err_fail

            ....

            err_fail:

            free(*s); // leaking ((*s)->substructure)

            1. Electron Shepherd

              It's not a leak. If the sub-structure allocation succeeds, the goto just after it is there to skip round the free. The free is only called if the first malloc succeeds and the second fails, and in that case, you want to free *s but not the sub-structure.

              Having said that, the confusion caused by a supposedly simple example of how to write good code with gotos is a shining example of why most people steer clear of them.

              1. Anonymous Coward
                Anonymous Coward

                Fair cop, I misread it.

            2. Vic

              Vic is correct, OP is leaking.

              No I'm not - I misread the sense of the allocation test - it changes betweent the two mallocs. The goto is on successful allocation for the second one. I should look more carefully next time.

              Although I don't make hard-and-fast rules about the use of goto, I think this is a case where it really shouldn't be used...

              Vic.

              1. Anonymous Coward
                Anonymous Coward

                Mea culpa, I made the same mistake.

      3. This post has been deleted by its author

        1. Suricou Raven

          Goto has some niches.

          In C, there is never a strict need to use goto. Anything that does need goto can be rewritten without using it - this can be proven mathematically. C without goto is still turing-complete.

          But it can sometimes be cleaner - a single goto can take the place of a chunk of code repeating twice and taking brackets five levels deep. Some consider the goto to be a tidier option.

          1. Carlie J. Coats, Jr.

            Re: Goto has some niches.

            It can also be proven that in the worst case, code length grows exponentially in the number of GOTO's eliminated.

            FWIW

          2. JustNiz

            Re: Goto has some niches.

            Code with gotos in it is far more brittle and will lead to far more unexpected side effects from making changes.

        2. Tromos

          @Def

          C is only ever a terrible, insecure language in the hands of a terrible, insecure programmer.

          1. dajames

            Re: @Def

            C is only ever a terrible, insecure language in the hands of a terrible, insecure programmer.

            Maybe ... but Sturgeon's Law applies.

          2. smartypants

            Re: @Def

            This is wrong.

            Even very good c or c++ developers make errors that can be security holes. All you can say is that they are less likely take them, which isn't really good enough. These languages often silently hide these flaws, ripe for exploitation later. Lots of tools help identify the flaws, but it's a lot of effort.

            It's the 21st century and we still have languages that demand perfection from flawed humans. No wonder this site is stuffed with exploit news.

          3. This post has been deleted by its author

            1. bazza Silver badge

              Re: @Def

              @Def,

              "Modern languages, in recognition of that fact, attempt to make it as hard as possible for a programmer to screw up - certainly in such obvious ways."

              Cough Javascript cough...

              1. This post has been deleted by its author

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like