Slashdot Mirror


Linux Kernel Code Humor

An anonymous reader writes "This article points to some pretty funny comments and code in the Linux kernel. From colorful metaphors, to burning printers, to happy meals... A recursive search through the entire code base reveals some interesting language. Is all code like this?"

20 of 485 comments (clear)

  1. Diary (and calendar) of a die-hard programmer by Gaxx · · Score: 4, Interesting

    In the days when I was a die-harder coder (unlike the current easy life as a part time manager and part time developer) I used to keep my diary and calendar in code comments - those were, of course, the days without funky handhelds with funkier PIM systems :-) *sigh* The good old days....

    --
    -- Gaxx
  2. Sometimes, and it can cause problems too. by Anonymous Coward · · Score: 5, Interesting

    A couple years ago the company I'm working for had sold the source to one of their business commerce systems to another company. The comments were sprinkled with some superlatives such as 'fuck' and 'son of a bitch' not to mention that there were a few other not-so-nice comments about other products like 'since this fucking windows bug' or what not heh. This other company was NOT very happy at all. It resulted in one person being let go when there were some small "budget" problems even though they just sold some software for over a million and this company wasn't very large (under 20). After he was let go they hired 3 new people. Lukly I just started about a week before this happened so I never got in trouble. Anyway, now the management scans the comments periodically to look for colorful words.

    1. Re:Sometimes, and it can cause problems too. by Reziac · · Score: 3, Interesting

      idSoftware had a little util called "unfuck" that they would apply to their source before sending it off to the latest licensee. Gee, I wonder why? :)

      Somewhere in one of the Paradox 3.5 for DOS executables, someone left a brief rant on upper management (it's readable text in the executable). Betcha that was some interesting source...

      --
      ~REZ~ #43301. Who'd fake being me anyway?
  3. Re:Is all code like this? by 2000+Britneys · · Score: 2, Interesting

    Right and the folks who developed windows code base and applications for M$ are highly professional?

    what about the hidden games in MS Office and developers fun page in one of windows OSes?

    talking bout "highly professional" developers here!!!!!!

  4. at my last job by pizza_milkshake · · Score: 3, Interesting

    i was reprimanded for extensive offensive language in my code. how else to keep it interesting?

  5. Re:The netcat code by sirket · · Score: 5, Interesting

    Ahh found the exact line:

    /* linux, which is trying as desperately as the gnu folks can to be POSIXLY_CORRECT. I think I'm gonna hurl... */ -- *Hobbit*, taken from the netcat source

    -sirket

  6. Funny comments from other systems by Anonymous Coward · · Score: 5, Interesting

    In the VM subsystem for the Sun-3 kernel, about late 1986 I think, there appeared the following:

    panic("Shannon and Bill say this can't happen");

    One of the first mass market Unix boxes was sold through the now-defunct line of Tandy computer stores and contained a 68000 and a Z-80 as an I/O processor. They apparently had problems with the Z-80 going insane periodically. This would be noticed by the 68000 which would then...

    panic("Beam us up Scotty, she's sucking mud again");

    Of course the most famous of all is the comment in the task switching code of the original v6 Unix (Lyons commentary era) which said ... /* You are not expected to understand this */

  7. Re:Is all code like this? (I hope so!) by jdkane · · Score: 3, Interesting

    I think a sense of humor represents the imaginative side of the programmer. I find that programmers with a sense of humor often produce more creative solutions and aren't as afraid of the code or the solutions compared to their more staunch, anal-retentive counterparts. The coder with a sense of humor seems to live for creative endeavour of the coding, and in my opinion often produces a better solution sometimes even faster because they are enjoying the process. And if the humor gets reflected in the code then so be it -- we call all share in the laughs.

  8. Ok, what's interesting is: by dagg · · Score: 3, Interesting
    This guy was looking for something that was:

    I was looking for something terribly complicated and looking awesome to the eye...

    ... to put on a T-shirt. Most all his replies consisted of expletives and weird crap found in the kernel. Expletives are just more interesting than elegant code, I guess.

    --
    Sex - Find It
  9. malloc by Anonymous Coward · · Score: 1, Interesting

    My fav source is the malloc source for FreeBSD, it isn't so much funny as upbeat. I feel inspired when I read it.. All code should be commented like it...

    #define SOME_JUNK 0xd0 /* As in "Duh" :-) */ /* Are we trying to die? */
    static int suicide; /* If we are already sinking, do not making things worse */
    if (suicide) return;

    But then ther is some code I have read by people that is just boring and sad... you can see their flustration in their comments, and their code usually causes problem.

    Where the malloc and general VM implementation of FreeBSD tied together is what has made it the powerhouse it has always been in a paged environment. You can read college style papers on the theory behind it, and people had fun implementing it. Funny how that works.

    Furthermore, as a small hint... on freebsd, it was always good to make a file called malloc.conf in the /etc directory, and put nothing but the letter H in it. Effectivly it will never make a difference due to the fact unused pages eventually get swaped out.. but it helps keep the resident size of your programs down...

  10. Not all, but a lot by Syphonius · · Score: 2, Interesting

    At my company, yes, there are interesting comments all through the code. They aren't as colorful as the Linux kernel though (those kind of comments would probably get you in trouble in a business setting).

    I like to think that having interesting comments (non abusive comments mind you) in the code shows the developers are enjoying themselves and working on something they like and with a team they like. Our code is sprinkled with numerous quips and questions and many comments are part of a running joke involving one of our team members and his (humourous, not real) abusive drinking.

    You do have to be careful though. In one previous version of our product some Javascript code (i.e. viewable in the browser) went out with a comment along these lines: "How could this have ever worked? No one must have tested this part at all." It was removed shortly after a customer called to complain about it. :)

  11. redefines the meaning of 'low end.' by kfg · · Score: 4, Interesting

    I guess this is why Road Runner stuck me with one of these things.

    They probably don't pay as much per unit as a decent chocolate bar.

    It brings up an interesting use for having source though, even if you don't code. Before buying a particular bit of hardware it might be interesting to read the driver comments to see what the programer thought of the thing at the low level.

    KFG

  12. Strangely enough ... by Aceticon · · Score: 4, Interesting

    ... (or maybe not) i usually find more funny comments in code from people who actually like coding (and are good at it) than from code monkeys .

  13. A few snippets... by La+Temperanza · · Score: 2, Interesting

    linux/arch/mips/kernel/sysirix.c:

    /* 2,191 lines of complete and utter shit coming up... */

    linux/net/ipv4/netfilter/ip_conntrack_core.c :

    while ((h = get_next_corpse(kill, data)) != NULL) {
    /* Time to push up daises... */
    if (del_timer(&h->ctrack->timeout))
    death_by_timeout((unsigned long)h->ctrack);
    /* ... else the timer will get him soon. */
    ip_conntrack_put(h->ctrack);

    linux/drivers/net/ eepro.c:

    printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n");

    linux/net/ipv4/ip_gre.c:

    #ifndef I_WISH_WORLD_WERE_PERFECT

    /* It is not :-( All the routers (except for Linux) return only
    8 bytes of packet payload. It means, that precise relaying of
    ICMP in the real Internet is absolutely infeasible.

    Moreover, Cisco "wise men" put GRE key to the third word
    in GRE header. It makes impossible maintaining even soft state for keyed
    GRE tunnels with enabled checksum. Tell them "thank you".

    Well, I wonder, rfc1812 was written by Cisco employee,
    what the hell these idiots break standrads established
    by themself???

    Don't forget to grep the source for "borken" - did they typo alone or were aliens involved?

    --

    --
    est modus in rebus
  14. We need more comments like this! by coyote-san · · Score: 5, Interesting

    While this comment is humorous, it's also very deep. It shows that the coder understood what he was doing well enough to know that the behavior wasn't as expected... and anyone else touching the same code should expect problems.

    It's rare, thankfully, but it is possible for code to trigger obscure compiler or even CPU bugs. These can be virtually impossible to track down, esp. if your boss is (justifiably) skeptical of your claim that the problem has to be in the compiler. In these cases the best you can do is flag the code as something that's very flaky.

    (BTW, I have some personal experience with such code. I just hit one with a PNG decoder - one mode had a rare decoder error that would flip one pixel, but the mode meant that the error was propagated across multiple scan lines. A very careful review of the code showed no error, and when I tested the code on different hardware (a PC, not an embedded device) it worked perfectly on the same images. Therefore it has to be the cross-compiler or hardware, and all I could do was document the problem.)

    --
    For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
  15. Re:Is all code like this? by Anonymous Coward · · Score: 1, Interesting

    at our mainframe shop one of our tech guys had some datasets with various jobs of his with names like

    STUPID.FUCKING.PROGRAM
    SYS3.SHIT.OUTDEF

    etc.. manager caught word and semi-pissed he was.

    also at one time they tried hooking up this network monitoring stuff to monitor some subcontractors on the floor's useage of our network resources. we kept getting alarms for "sex", of course it turned out to be someone's network password.

  16. Re:The purpose of comments is to be USEFUL... by Elwood+P+Dowd · · Score: 3, Interesting

    Work is done better by those who enjoy themselves doing it.

    This is a common misconception. Unhappy, overly criticized workers are less likely to make mistakes, and get more accomplished. In the general case. Extensive research on the subject has been published, although I'm not interested in hunting it down.

    --

    There are no trails. There are no trees out here.
  17. ASCII Art comments by Drakonian · · Score: 3, Interesting
    This is ironic. Yesterday, I was enraged at the embedded system compiler I was using and put in a very large ASCII art warning against doing something that you SHOULD be allowed to do that took 30 hours to debug.

    If you ever need ASCII art comments, head here:
    ASCII Generator. It can use many different "fonts". Great utility.

    --
    Random is the New Order.
  18. Mainframe humor: BDOLVB by cant_get_a_good_nick · · Score: 4, Interesting

    I remember reading this as part of a warning really. There was a mainframe app, and there was a constant, and it was called BDOLVB. Some maintenance programmers inherited the system, and saw the obove constant, and didn't know what the hell it was. They tried to look it up, figure out what the meaning was, and they couldn't figure it out. They could see what it was set to, 1770 Octal, but didnt know what it meant. They put looking into it on the back-burner - the system worked but they were stil curious about the meaning. Eventually, after months, they found oout what it meant.
    1770 = BirthDate Of Lidwig Van Beethoven
    Since they spun their wheels for a few days tracking this down, they weren't smiling all that much at the cleverness of this.

    The thing to remember is that code is harder to read than to write. The author has context, information that the reader doesn't have and has to guess at. If you want to be funny, do so, but don't interfere with the ultimate goal of source, to make it easy for people to see and change your code.

  19. Re:Well no, it's not all like that by plover · · Score: 3, Interesting
    I beg to differ. Excel '95 had far and away the most elaborate Easter egg I've ever seen. It was a built-in 3D Doom-style temple. You could walk around a la first-person shooter and read the names of the developers on the walls.

    Naming an empty macro "Magic 8-ball" in Word '95 and putting it in the toolbar would give you a magic 8-ball shaped icon that would randomly spew the "Don't bet on it" or "Reply hazy-try later" kind of answers when you clicked on it.

    Easter eggs weren't the exclusive province of the Office development team, either. The first 3D text screen saver under NT 3.51 had a couple of Easter eggs. Typing BEER into the text would bounce around names of beers. Typing VOLCANO would bounce around names of volcanos.

    But once the temple thing was made public in the wild, Microsoft got all suity and made a big stink about it, and they claimed they'd fire anyone responsible for putting any new Easter eggs into any Microsoft product.

    --
    John