Slashdot Mirror


Inside the OpenSolaris Source Code

An anonymous reader writes "Ten million lines of code and not a single profanity? Is that really possible? Apparently, yes, says OpenSolaris community manager Jim Grisanzio. He said even before Sun filtered the code, it was relatively free of profanity. 'They went through the code for a great many things,' he said, 'and I'm sure they cleaned a word or two. Or three.' But a careful look through the code will reveal some programmers' frustration." From the article: "The most embarassing comment came from a developer of the GRUB project who went only by the name of 'Gord'. 'This function is truly horrid,' he wrote. 'We try opening the device, then severely abuse the GEOMETRY->flags field to pass a file descriptor to biosdisk. Thank God nobody's looking at this comment, or my reputation would be ruined.'"

31 of 338 comments (clear)

  1. Odd Fascination by AKAImBatman · · Score: 4, Interesting

    What's this fascination with dirty words in the code? I can't say that I've even considered writing such a thing in commercial code that I write. Unlike OSS code, other coworkers *will* be reading my comments and may not think they're that funny. (Although I love messing with test data. Batman, Picard, Superman, Professor X, Dylan Hunt, etc. are all game. Unfortunately, they all share a phone number with Jenny. Must be one of those antiquated shared lines. ;-))

    Perhaps the most telling part of the article is that it's the Open Source code that has the foul language. Which isn't too surprising. If there are no repercussions for such behavior, why wouldn't developers engage in it? But in a straight-laced commerical environment? Unlikely. (Or at least uncommon.)

    1. Re:Odd Fascination by BlogPope · · Score: 5, Funny
      What's this fascination with dirty words in the code?

      The code might be compiled and run on some unsuspecting souls computer. Once the computer learns that kind of language, the next thing you know it will be downloading porn!

      I should know, that how it got on my computer!

      --
      My other car is a Popemobile
    2. Re:Odd Fascination by Chibi+Merrow · · Score: 4, Interesting

      It's not like the customer will ever see the code

      Famous last words?

      I'm suddenly reminded of !seineew era sreenigne epacsten!

      --
      Maxim: People cannot follow directions.
      Increases in truth directly with the length of time spent explaining them
    3. Re:Odd Fascination by utuk99 · · Score: 5, Interesting

      My favorite is I had to write about 50 different modules for a program. So I put a George Carlin quote at the begining of each module from brain droppings. No one except the small group of developers I work with would ever see it right. Unfortunately all of our code got subpoena. They obviously had no idea what the code was doing because out of 10 boxes of printed code, what do you think they had questions about? You guessed it the Carlin Quotes. There were a few sections with things like "Fear ye who enter here!" at the beginning of some really ugly subroutines. Ever since then I have had very innocuous comments in my code. Ok, I at least make them look innocuous to the casual observer.

    4. Re:Odd Fascination by deKernel · · Score: 3, Interesting

      Well, I have been writing software for more years than I want to admit, but here is my take.

      Other than using some terms that are really bad (c#@!, f$#% and such), there is nothing wrong with the developer putting his thoughts in the code. Somethings it will help the next person understand what the developer was thinking.
      I will give you an example. Ugly hacks are bad but sometime necessary. Fact of life. If you have to support someone elses code, you might feel the need to say something bad about the person based upon what see in the code and how they got it to work. If you see comments like "... I realize that this really sucks and a major hack but I it does work..." you most likely will hold off your comments. Its called venting!!!!

    5. Re:Odd Fascination by LittLe3Lue · · Score: 5, Interesting

      !seineew era sreenigne epacsten!

      Translates to (when read backwards): Netscape engineers are weenies!

      Here is the explanation taken from this article:

      Don Rickles apparently writing code at Microsoft:: In the aftermath of Microsoft's admission Friday that its engineers had included a secret password in some of the Web site authoring software shipped with Microsoft's Windows NT operating system -- which The Wall Street Journal claimed could be used to gain unauthorized access to Web sites -- the editor of the Microsoft-software security site NTBugTraq came forward to offer some clarification on the matter. In a message posted to the NTBugTraq mailing list Cooper wrote, "This is a hole that could allow information to be manipulated by others. However, it's limited to 'others' who already have Web authoring permissions on the same box." Cooper added that the secret password in question--"!seineew era sreenigne epacsteN" IE: "Netscape engineers are weenies!" -- wasn't a password at all, but a cypher key which only allows access to the security breach, not the security breach itself. However, over the weekend, two programmers revealed that they were able to disrupt Web servers by exploiting a different vulnerability in the same file. Microsoft confirmed that assertion, indicating that the pair had discovered "a new, separate vulnerability that significantly increases the threat to users of these products" and that "could be used to cause an affected server to crash." (Wall Street Journal story; paid registration required). In any event, when Microsoft issues a patch for this, as it inevitably will, you'll find it here.

    6. Re:Odd Fascination by sconeu · · Score: 3, Funny

      Reminds me of a story my old manager once told me.

      He was writing some artillery control software, and written a Fire Unit Check routine. He didn't even consider the acronym. Needless to say, at the code review, it got changed.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
  2. Grub is a bootloader by Dancin_Santa · · Score: 3, Insightful

    Hardly part of the actual OS.

    Sounds like Sun did a bang-up job with their software, reining in the developers under pretty solid coding guidlines. It's the Open Source people who have gone off and sullied the code with their silliness.

    Humor in comments is sometimes good. Just not on Slashdot where it only risks your karma.

    1. Re:Grub is a bootloader by Anonymous Coward · · Score: 5, Informative

      Grub is an official GNU project and thus, GPL. Gords comment was intended to be humourous. I'm not surprised the ZDNet hack missed it though. After all, understanding what GRUB is might require that they're are familiar with their subject, and that's just too much to ask these days..

    2. Re:Grub is a bootloader by arivanov · · Score: 4, Interesting

      Silliness???

      As far as the kernel is concerned the number of profanities is a clear reflection of the quality of the underlying hardware. One of the things I do before buying new hardware is look at the comments in the linux kernel code. If they are like the ones you meet in the sun** architecture bit (it is the most profane part of the linux kernel) it may be a good idea to stay away.

      For example just read the sunhme.c under drives/net. It is an absolute ROFL. Or arch/sparc/mm/ptrace.c ...

      --
      Baker's Law: Misery no longer loves company. Nowadays it insists on it
      http://www.sigsegv.cx/
  3. Nice humour by moz25 · · Score: 5, Insightful

    I like the guy's humour. Either that or he is not smart for putting a reputation-ruining 'bomb' in the source code :-) But anyway... good programmers are supposed to be very critical of their code so even functionally correct code can be commented as though it were horrible.

  4. http://cvs.opensolaris.org/source/search?q=fucking by Anonymous Coward · · Score: 5, Informative

    yep, no profanity at all

  5. 10kHz in 1996 by arete · · Score: 4, Insightful

    ZDnet seems to want us to think "clock speeds" are at 3 Ghz regarding the following quote:

    'Another tried his hand at predicting the future of system speeds. "As of this writing (1996) a clock rate of more than about 10 kHz seems utterly ridiculous, although this observation will no doubt seem quaintly amusing one day," he wrote.'

    But in 1996 you had roughly 100Mhz 486s and Pentiums, so clearly it's not that clock, it's some other clock.

    --
    Looking for freelance Actionscript (Flash/Flex) or ColdFusion work and/or freelance developers. Email me, put Slashdot
    1. Re:10kHz in 1996 by Chirs · · Score: 4, Informative

      Most likely this refers to the system tick. On linux this was 100Hz for most architectures in 2.4, although with 2.6 most architectures have moved to 1KHz.

    2. Re:10kHz in 1996 by iabervon · · Score: 3, Informative

      That's almost certainly the clock interrupt, which, at the time, was generally 100 Hz on Linux, and is now generally 1 kHz. In fact, the thing that's likely to seem quaint before too long is having a constant value, not expecting the value to be less than 10 kHz. This clock is related to system speed, in that it's basically the rate at which housekeeping tasks get done, and it's enough slower than the processor speed that a useful amount of work gets done between ticks, and fast enough that the delay isn't too noticeable when you have to wait for it to tick.

  6. Has anyone found ... by ratta · · Score: 5, Insightful

    something really interesting in the code, now that Solaris is open? People has been saying "Sun will never open Solaris" for month, now that it is open all that they do is to grep "fuck" or "shit", or look for frustrated comments?

    --
    Wondering why i am doing so strange posts? I am trying to get a "+5,Flamebait" or "-1,Insightful" rating.
    1. Re:Has anyone found ... by mrm677 · · Score: 5, Interesting

      Yes, the locking code in mutex.c is fascinating. They dynamically switch between spin-locks and adaptive backoff locks based on who is running and who is locking what. This is the stuff that makes Solaris scale to dozens of processors out-of-the-box.

    2. Re:Has anyone found ... by Myopic · · Score: 3, Insightful

      kudos. you just outgeeked a lot of us.

    3. Re:Has anyone found ... by Paul+Jakma · · Score: 4, Interesting

      the CDDL specifically prohibits me from learning anything from looking at the OpenSolaris code.

      This is untrue and absurd.

      Because its covered by a "file-based" license, I can either take files in full, or not at all.

      This is again untrue.

      The CDDL licence allows you to modify CDDL code, as long as the resulting file is CDDL licenced. So you can take a file, strip out stuff you're not interested in and use that (under the CDDL licence).

      I am not covered by the CDDL (and would be in violation of it) by taking snippets of code from any of the files,

      This is untrue.

      You may take CDDL code and use it as you wish, provided the resulting file is also CDDL licenced. You can have your code link to this CDDL code, and your code can be under whatever licence you like.

      including viewing them and "paraphrasing" what I learn back into my own code.

      Untrue.

      You are allowed to do this, provided that the files which were modifications of CDDL code stay under the CDDL. Your own code you may licence as you wish. If rather you mean that you want to "steal" CDDL code, modify it and bury it in your own proprietary licenced application well, sorry, no, you can't do that - no more than you could with MPL or GPL licenced code.

      Also, there ARE patented concepts in the OpenSolaris code, which you are welcome to use, as long as you use entire files (i.e. covered by the "file-based" license).

      Correct, and you may also modify those files, provided the modified files are made available under the terms of the CDDL.

      I don't want to put any of my clients or projects at risk, so I can't look at the code.

      At risk of what exactly? Your tendencies to want to take other people's code and relicence it? Your email address says '@gnu-designs.com', but I wonder if actually you're a BSD licence fan. :) Note that patents are applicable regardless of whether you have looked at the code implementing them. Even if you don't know about the patent, they still apply. (However, willfully breaking a patent tends to result in higher damages).

      So nope, I haven't even looked at the code, because frankly, I can't, without contaminating my own code and ideas.

      Looking at CDDL code is not going to do that.

      Note that copyright does not disallow you to look and reimplement. Note further that not looking does not protect you against patent claims.

      If you truly were concerned about protecting your clients from patent risks in your own code, then your safest bet would be to take the CDDL code and link to it: with your own code under whatever licence you want, the CDDL code implementing the patent and providing you and your users with a grant to use the patent.

      You havn't fallen for the FUD put about by a certain libc hacker have you? (Who just happens to work for a competitor of Sun's? Pure coincidence of course..).

      --
      I use Friend/Foe + mod-point modifiers as a karma/reputation system.
  7. everyone gets burned by micromuncher · · Score: 4, Funny

    Hasn't everyone been burned by this? And why is it a big deal? It's not like professional developers never curse or get frustrated.

    It is worse when questionable things get present to end users and/or clients. In a UI demonstration of an accounting project, I had a button called "Do Me". It didn't go over so well. But somehow it came out that one of the underlying combo boxes was called "ViagraComboBox" because it outperformed... that didn't go so well. So now all my code is antiseptic, just because its not good to show "unprofessionalism" infront of the client.

    The worst thing I've ever heard was a friend gave a demo of a pipeline monitoring application to a client. During the course of a demo, a pumping station turned red to show an alarm, followed by a small mushroom cloud animation... suffices to say the client walked out of the meeting. (But hey, he now works at Microsoft.)

    --
    /\/\icro/\/\uncher
  8. my favorite comment by k4_pacific · · Score: 4, Funny

    In a piece of C code where I work that has Unicode support, I saw this comment, by itself, within a routine that did some string manipulation: // I'm hot for TCHAR.

    --
    Unknown host pong.
  9. Re:Is Gord reading Slashdot? by Chmarr · · Score: 3, Informative

    I hear Gord dropped out of the video game store market, and is teaching english in Korea.

  10. More checking needed by Espectr0 · · Score: 3, Informative
  11. embarrasing code.... by MauMan · · Score: 5, Funny

    I remember once when I was was trying to track down a bug I wrote some debugging code which I then commneted out with: #ifdef _SEX_WITH_FARM_ANIMALS_ ...Debugging code... #endif Later, someone wanted to integrate with my code so I saved it off to the interim repository and a few minutes later I got a visit from my co-worker.

    Boy he had some fun at my expense...

    --
    ------- Code to try when you're bored: qsort( 0, UINT_MAX, sizeof( int* ), IntCompare );
  12. Another client horror story. by CyricZ · · Score: 4, Funny

    I worked at a pretty laid back development firm developing various applications in VB. Well, one of the projects was a school library management system. One of my coworkers was, well, a bit of a freak. He had a strange obsession with penises and boners.

    One of his jokes was to attach code to a button that would make an animation of a penis erecting and ejaculating appear, but only after every 7 or 8 clicks of that button. Normally he would only keep such code in for a day or so, until somebody in QA ran across it.

    Anyway, at one point we were at a conference of school librarians demoing our product to them. Things were going well, until we clicked on a button, and up on the large screen came an animation of an erect penis ejaculating. Needless to say, we were quite embarrassed! I don't think he was with the company much after that.

    --
    Cyric Zndovzny at your service.
  13. Re:http://cvs.opensolaris.org/source/search?q=fuck by happymedium · · Score: 4, Funny
    1782 for (tp = node->tgn_typelist; tp != NULL; tp = tp->tgt_next) {
    1783 if ((kind = mdb_ctf_type_kind(tp->tgt_type)) == CTF_K_UNION) {
    1784 /*
    1785 * Fucking unions...
    1786 */
    1787 found = NULL;
    1788 break;
    1789 }
    Aha! Clearly, Sun programmers oppose organized labor! Such shameless politicking--in code, no less... tsk, tsk...
  14. Re:Who cares? by MynockGuano · · Score: 4, Funny
    In today's modern galaxy there is of course very little still held to be unspeakable. Many words and expressions which only a matter of decades ago were considered so distastefully explicit that were they to be merely breathed in public, the perpetrator would be shunned, barred from polite society, and in extreme case shot through the lungs, are now thought to be very healthy and proper, and their use in everyday speech is seen as evidence of a well-adjusted, relaxed, and totally un****ed up personality.

    So for instance, when in a recent national speech the Financial Minister of the Royal World Estate of Quarlvista actually dared to say that due to one thing and another and the fact that no one had made any food for a while and the king seemed to have died and that most of the population had been on holiday now for over three years, the economy was now in what he called "one whole joojooflop situation," everyone was so pleased he felt able to come out and say it they quite failed to notice that their five thousand year-old civilization had just collapsed overnight.

    But though even words like joojooflop, swut, and turlingdrome are now perfectly acceptable in common usage there is one word that is still beyond the pale. The concept it embodies is so revolting that the publication or broadcast of the word is utterly forbidden in all parts of the galaxy except one where they don't know what it means. That word is 'belgium' and it is only ever used by loose-tongued people like Zaphod Beeblebrox in situations of dire provocation.
  15. Don't forget to strip symbols, too! by Dr.+Manhattan · · Score: 3, Funny
    At my last job a guy told me the story of a programmer forced to implement some stupid feature due to a customer demand. He made the behavior dependent on a conditional variable named "CustomerIsAnIdiot".

    Then the customer hooked up a debugger...

    --
    PHEM - party like it's 1997-2003!
  16. Amusing things that frequently end up in my code: by allanc · · Score: 3, Funny

    1. BHAD ('Breach Hull, All Die'). When I'm writing code that I don't expect other people to use, this is the name I give to error-handling stuff.

    2. "OH MY GOD BEAR IS DRIVING CAR!" is how I tend to label code that should Never Happen. I was working as a contractor at my current company and this ended up in some of my code. After they decided to hire me on as a full time employee, my boss mentioned that this comment was one of the primary factors in that decision. It's good to work for a company with a good sense of humor. :)

  17. Source browser in the wrong hands by ahl_at_sun · · Score: 3, Insightful
    This article has all the sophistication of a 5-year old looking up 'anus' in the OED. Someone already pointed out the confusion between the processor clock and the system clock -- a confusion that would have been avoided if the author had read the code or even the rest of the comments.

    More ludicrous is the author's supposed identification of a Mark Felt lurking in the shadows of the DTrace code:
    The much-vaunted dynamic tracing (dtrace) feature of Sun's system may not be as safe to use as most people think.
    That's based on what? The two ASSERTs that follow the cited comment? This one doesn't go all the way to the top...
  18. Censorzilla by chickenwing · · Score: 3, Interesting

    JWZ has a selection of some of the choice obscenities from Netscape: http://www.jwz.org/doc/censorzilla.html