• Linus Torvalds added hidden tabs to Kconfig to challenge parsers that can’t handle them.
  • Tabs were intentionally added to the common Kconfig file for page sizes to expose faulty parsers.
  • Torvalds believes parsers unable to handle tabs shouldn’t be parsing kernel Kconfig files, aiming to force fixes.
  • merthyr1831@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    The Register did a good article covering the change.

    Source files should be conservative with the standard they expect from the developer, and parsers should be liberal in what they expect from the source, ie. allow deviations from the standard.

    Python for example supposedly only allows 4 spaces for indentation, but as long as the developer is consistent most if not all Python interpreters will accept any kind of indentation.

    • barsoap@lemm.ee
      link
      fedilink
      arrow-up
      0
      ·
      5 months ago

      Python for example supposedly only allows 4 spaces for indentation, but as long as the developer is consistent most if not all Python interpreters will accept any kind of indentation.

      That’s a recipe for disaster as your syntax is under-specced. You’re right-up inviting programmers to produce programs with implementation-defined semantics.

      Haskell (which also uses layout syntax) never had that problem as tabs were simply defined to be eight spaces, but that then led to issues with people setting different tab-widths in their editors and a flurry of syntax errors when they did “tabs for indentation, spaces for alignment”. Which is why Haskell then moved ahead to outlaw tabs, I think it’s still in the “throw a warning” phase but at some point it’s going to be a hard error.

      That’s not to say that kconfig should do the same – presumably they used tabs for a good reason, and all those other programs are simply not following the spec. Essentially including unit tests in the actual production files is a good move when you’re dealing with that kind of situation.

      • UndercoverUlrikHD@programming.dev
        cake
        link
        fedilink
        arrow-up
        0
        ·
        5 months ago

        Eight space indentation should be crime, I’m not made out screen width over here.

        If you want to be strict with indentation, use tabs as your standard instead of forcing others to use your preferred visual width.

    • Subverb@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      5 months ago

      Having a language dependent on indentation is absurd on the face of it. It’s a ridiculous idea that should have been ridiculed from the outset.

      • barsoap@lemm.ee
        link
        fedilink
        arrow-up
        0
        ·
        5 months ago

        No. Having a language depend on semicolons even though there’s ways to do without, ways that don’t even include layout if you don’t want to, is well not absurd on the face of it it’s hysterical raisins.

        Haskell has one of the most admired syntaxes out there, and it’s layout. It’s clean, predictable, very simple and most of all intuitive rules. It makes sure that semantic structure always follows visual structure, thus provides a single source of truth why Algol-likes (i.e. everything that looks at least vaguely like C) have two.

        I don’t indent my Rust, I let rustfmt do that. All that automation and I still get into lots of missing or mismatched braces situations which literally never happen in Haskell because the structure of the program is visually obvious, you don’t have to look for tiny squiggles to figure out what it is.

  • BigMikeInAustin@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    I do the same to people who refuse to follow specifications they agreed to follow.

    There is a slight satisfaction to get back at them for continually delivering much lower quality than is required.

    But it really is to cover me. Because, it always happens, later in the future that edge case comes up, and everything breaks. And management is ready to blame me. But then I show them that I tested the edge case before the conclusion of the project. And that programmer ignored my emails, and that I told management these edge cases weren’t covered. But then management signed off on calling it complete. And suddenly management is no longer red with fury. And they usually won’t allow me time to fix it. So the can gets kicked down the road until the next time that edge case fails.

    • luciferofastora@lemmy.zip
      link
      fedilink
      arrow-up
      0
      ·
      5 months ago

      Me: “This is the file format we agree on.”
      They: “Yep, that’s what you’ll get.”

      They: “Why is your script not working?”
      Me: “Idk what was the last file you put through it?”

      In their defense, they got the file from a third party that we both previously assumed competent enough to follow explicit written instructions. Guess there’s a lesson in trust…

  • AutoTL;DR@lemmings.worldB
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    This is the best summary I could come up with:


    Within yesterday’s Linux 6.9-rc4 release is an interesting little nugget by Linus Torvalds to battle Kconfig parsers that can’t correctly handle tabs but rather just assume spaces for whitespace for this kernel configuration format.

    Due to a patch having been queued last week to replace a tab with a space character in the kernel tracing Kconfig file, Linus Torvalds decided to take matters into his own hand for Kconfig parsers that can’t deal with tabs… Torvalds authored a patch to intentionally add some tabs of his own into Kconfig for throwing off any out-of-tree/third-party parsers that can’t correctly handle them.

    Torvalds added these intentional hidden tabs to the common Kconfig file for handling page sizes for the kernel.

    Torvalds wrote in the patch: "Commit d96c36004e31 (“tracing: Fix FTRACE_RECORD_RECURSION_SIZE Kconfig entry”) removed a hidden tab because it apparently showed breakage in some third-party kernel config parsing tool.

    Yes, tab-vs-space confusion is sadly a traditional Unix thing, and ‘make’ is famous for being broken in this regard.

    I’d add more random tabs to our Kconfig files, but I don’t want to make things uglier than necessary.


    The original article contains 308 words, the summary contains 184 words. Saved 40%. I’m a bot and I’m open source!

  • rollmagma@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    Wow, super newsworthy. Even included some bs about “colorful language”. Can’t let a thing like that go by without trying to entice some internet drama.

  • tooLikeTheNope@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    5 months ago

    Torvalds believes parsers unable to handle tabs shouldn’t be parsing kernel Kconfig files, aiming to force fixes.

    Stern but just

  • TCB13@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    5 months ago

    “if you can’t parse tabs as whitespace, you should not be parsing the kernel Kconfig files.” ~ Linus Torvalds

    This is what we got after people sent him into PC training. The OG Linus would say something like “if you’re a piece of s* that can’t get over your a** to parse tabs as whitespace you should be ashamed to walk on this planet let alone parsing the kernel Kconfig files. What a f* waste of space.”

  • Nik282000@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    Why would anyone NOT parse a tab as whitespace? Like, python really wants you to use spaces but will still let you use tabs if you are consistent.

  • PanoptiDon@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    Reminds me of Beethoven writing Für Elise for sometime he loved, and when he was rejected, the music was finished in such a way that she could not play it.

  • palordrolap@kbin.social
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    The Robustness Principle may seem like little more than a suggestion, but it is the foundation on which many successful things are based.

    To boil it down to meme-level old-school Torvaldsry: Assume everyone else is a f–king idiot who can barely do what they’re supposed to and expect to parse their files / behaviour / trash accordingly.

    If you do not do this, you are, without doubt, one of those f–king idiots everyone else is having to deal with. If you do do this, it does not guarantee that you are not a f–king idiot. Awareness is key.

    Examples where this works: Web browser quirks mode; Driving a car; Measure twice, cut once. This latter one is special because it reveals that often, the f–king idiot you’re trying to deal with is yourself.

    Assume everyone else is worse.

    Fun corollary: In altering his behaviour towards f–king idiots people who should know better, Linus has learned to apply the robustness principle to interpersonal communication.

      • lolcatnip@reddthat.com
        link
        fedilink
        English
        arrow-up
        0
        ·
        5 months ago

        Sometimes it works well as a stylistic choice. It’s not pretending not to use a bad word, but rather drawing attention to the fact that you’re deliberately being a little bit naughty with a wink to the reader. It’s like the absurdity of what happens when you find a stranger in the Alps.

      • mino@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        5 months ago

        I don’t understand this either. There’s no fucking algorithm overlord here right? No fucking tiktok, youtube bullshit required.

        If you want to say fuck, fucking say fuck.

        On another note. Thx for introducing me to the robustness principle ♥️

        • palordrolap@kbin.social
          link
          fedilink
          arrow-up
          0
          ·
          5 months ago

          Maybe I want to say it without saying it. There’s no rule against doing that, but people somehow think there is - or that there ought to be.

          Most of the time I don’t swear, so it makes me uncomfortable to use the word. There have been and undoubtedly will be exceptions. When the mood takes me. When the word, unfettered, feels right. Today was not that day.

          Funny how the partial omission offends some people more than the original word does. Adapt your parsers.

          • half_built_pyramids@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            5 months ago

            On the fediverse we do not have to worry about upsetting coka cola or spez because a swear appeared next to their advertisement or name. Not that many people care about that elsewhere, but we especially don’t care about it here. I think that’s worth calling attention to every once in a while. It doesn’t always have to be swears as the vehicle to remind us that the power dynamic is different here.

            It’s fucking nice to be reminded there no corpo overlords here sometimes, though. Which is ironic that sometimes the foss benevolent dictators for life aren’t always benevolent.

            • palordrolap@kbin.social
              link
              fedilink
              arrow-up
              0
              ·
              5 months ago

              It’s not about whether other people are willing to accept it. It’s about whether I’m willing to generate it. This is the other half of the principle.

              • WldFyre@lemm.ee
                link
                fedilink
                arrow-up
                0
                ·
                5 months ago

                But you still used it, no one’s confused about what word you meant. It’s such an odd line to draw IMO.

                It’s like the “anal doesn’t count as REAL sex” nonsense, but for cussing lol

                • blind3rdeye@lemm.ee
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  5 months ago

                  Obviously the semi-censored version isn’t the same - otherwise you wouldn’t be talking about it. And the author has told you that it was a stylistic choice to use that different version. That’s enough, isn’t it? And judging by the reactions here, apparently the semi-censored version is even more hard-hitting than the full word!

                  Swearing is used for emphasis and to invoke a reaction. The attention it has brought here seems to show that it has invoked a reaction and captured people’s attention. Maybe that drawing of attention means it was fit for purpose - or maybe not. In any case, it was the choice of the author to do it like that.

            • DAMunzy@lemmy.dbzer0.com
              link
              fedilink
              arrow-up
              0
              ·
              5 months ago

              Oh, BS. You don’t have to worry about swearing on Reddit either. Yes, reddit sucks, but the censoring of words on there isn’t like TikTok.

            • VirtualOdour@sh.itjust.works
              link
              fedilink
              arrow-up
              0
              ·
              5 months ago

              Yeah though I have to admit I like it when people self censor because I imagine them like a cute Ned Flanders all flustered ‘well dang diddly h - e - double C!’

              But yeah it’s nice that platform’s exist simply for people to express themselves rather than to serve as vehicles for advertising. I’ll say fuck to celebrate that!

  • iAvicenna@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    I am no kernel or parsing expert here but how hard would it be to convert tabs to spaces? Is it like very finicky and is weirdly platform dependent that it wouldn’t just be one of the first things that you do if you are writing a parser for anything?