Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming Sun Microsystems IT Technology

Inside the OpenSolaris Source Code 338

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.'"
This discussion has been archived. No new comments can be posted.

Inside the OpenSolaris Source Code

Comments Filter:
  • Odd Fascination (Score:4, Interesting)

    by AKAImBatman ( 238306 ) * <akaimbatman@gmaYEATSil.com minus poet> on Thursday June 16, 2005 @11:46AM (#12832677) Homepage Journal
    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.)
  • I am vindicated! (Score:3, Interesting)

    by ChibiLZ ( 697816 ) * <john AT easygoldguide DOT com> on Thursday June 16, 2005 @11:49AM (#12832698) Homepage Journal
    I write very similar things into my code. My coworker and mentor yells at me about it. I think they're great little bits of levity when your code gets you down.
  • by Anonymous Coward on Thursday June 16, 2005 @11:49AM (#12832700)
    Code is so much better when your reputation is on the line amongst your peers.

    I always think that peer esteem is one of the biggest contributing factors to the quality of open source code.

  • Re:Odd Fascination (Score:5, Interesting)

    by Chibi Merrow ( 226057 ) <mrmerrow AT monkeyinfinity DOT net> on Thursday June 16, 2005 @11:55AM (#12832766) Homepage Journal
    It's not like the customer will ever see the code

    Famous last words?

    I'm suddenly reminded of !seineew era sreenigne epacsten!
  • Re:Odd Fascination (Score:5, Interesting)

    by utuk99 ( 656026 ) on Thursday June 16, 2005 @12:01PM (#12832802)
    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.
  • Re:Odd Fascination (Score:3, Interesting)

    by deKernel ( 65640 ) on Thursday June 16, 2005 @12:08PM (#12832857)
    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!!!!
  • by mrm677 ( 456727 ) on Thursday June 16, 2005 @12:09PM (#12832859)
    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.

  • Re:Odd Fascination (Score:2, Interesting)

    by 91degrees ( 207121 ) on Thursday June 16, 2005 @12:24PM (#12832971) Journal
    I will be informal, but never obscene. You will occasionally see comments like "Sorry fellas, but [explanation as to why I was forced to do it the way I did]" or maybe make a reference to a well known joke occasionally ("the wonderful thing about standards is there are so many to choose from"), and nobody cares about these. I think it would be considered unprofessional and really a little childish to add expletives.
  • by arivanov ( 12034 ) on Thursday June 16, 2005 @12:30PM (#12833017) Homepage
    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 ...
  • Re:Odd Fascination (Score:3, Interesting)

    by IAmTheDave ( 746256 ) <basenamedave-sd@yah[ ]com ['oo.' in gap]> on Thursday June 16, 2005 @01:50PM (#12833937) Homepage Journal
    What's this fascination with dirty words in the code?

    It's kinship. It's a way for programmers to be able to relate to one and other through shared frustrations. It also allows us to get more personal with the code, understand the thinking that went into it, and understand where and why certain features were programmed in certain ways.

    And finally, it's about support. "Ok, I'm not the only one who is frustrated." Misery loves company, and sometimes it's nice to know that you're not alone.
  • Censorzilla (Score:4, Interesting)

    by chickenwing ( 28429 ) on Thursday June 16, 2005 @02:02PM (#12834046) Homepage
    JWZ has a selection of some of the choice obscenities from Netscape: http://www.jwz.org/doc/censorzilla.html [jwz.org]
  • by hacker ( 14635 ) <hacker@gnu-designs.com> on Thursday June 16, 2005 @02:12PM (#12834165)
    "Has anyone found something really interesting in the code, now that Solaris is open?"

    Unfortunately, I can't. As a Open Source/Free Software author, the CDDL specifically prohibits me from learning anything from looking at the OpenSolaris code.

    Because its covered by a "file-based" license, I can either take files in full, or not at all. I am not covered by the CDDL (and would be in violation of it) by taking snippets of code from any of the files, including viewing them and "paraphrasing" what I learn back into my own 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). I don't want to put any of my clients or projects at risk, so I can't look at the code.

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

  • Re:Odd Fascination (Score:5, Interesting)

    by LittLe3Lue ( 819978 ) on Thursday June 16, 2005 @02:38PM (#12834417)
    !seineew era sreenigne epacsten!

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

    Here is the explanation taken from this article [siliconvalley.com]:

    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.
  • by kaladorn ( 514293 ) on Thursday June 16, 2005 @06:36PM (#12836735) Homepage Journal
    And sometimes they are also the place you express the frustration you feel at the particularly dismal piece of architecture someone handed you, that was a poor architecture in the first place and has subsequently been further bastardized into something whose design logic no longer exists in any coherent form, and in which any time you touch the code, there is a decent chance of side effects.

    I try not to be profane. If I really want to imply some sort of upset or exclamation, I'll got the old cartoon route of using @#$%^%&!!!!! as a replacement.

    But I find people sometimes shy away from identifying poorly architected code, odd inputs our outputs, or places where the approach taken was a kludge that needed to be thrown in but wasn't very good for fear of having an unflattering comment in place. Frankly, I'd rather know about these situations. I'm a big boy... if someone writes that a particular routine is a steaming pile of crap, that won't offend me, as long as the description is technically accurate (the routine actually is) and there is sufficient other data with the comment to tell me WHY this is so.

    A co-worker of mine put in this one recently....
    <ecode>
    ' Quick kludge because of time. Should not rely on global structure
    </ecode>

    Sure, it reveals that we've put a hack in when we should have done it a different way. But at least whoever the next poor bugger that comes along can be 'in the know' and not thinking that we mystically thought this was the 'right' way to solve the problem.

    I also like to put in comment tags I can quickly locate in a search (<i>ANAKIN, WORF, BLAKE, GARTH OF IZAR, etc</i>). Sometimes they get left in. Do they cause any grief? Not really. A friend of mine uses the tag <i>WALLY</i> for all of his temporary patches and now this has infested the code bases at at least 4 companies (and other developers use it). You know if you see a <i>WALLY<i> that there is something to pay attention to and usually the note indicates it is a patch, a kludge, or a less than optimal solution.

    Other sorts of comments that might not look so good might include:

    <ecode>
    ' [initials_deleted] - [date]
    ' THIS IS A FIX - we're holding off on implementing it, despite the fact is is the
    ' correct fix, in order to get the [version] release out the door. Default is [value]. This
    ' means we are writing the wrong thing into the DB. Yet, at the same time, if we fix
    ' it now, it means more work to fix and more risk. So, we want to fix it, we want to
    ' see this change in place, but not right now. So I'm leaving it here, but commented.
    '[line of code commented out]
    </ecode>

    I guess I've written a few comments late at night that I usually excise when the code goes into the repository for the builds. I remember some that crept through. A follow on developer asked me about a comment where I had written "I have no #$%! idea what this value is meant to be so it is utterly arbitrary...." (relating to line discipline for systems we didn't have specs on).
    Similarly, I've seen comments like "If you get here, we're TU" (Tits Up).

    I have seen supposedly benign test data that was never designed for primetime leak out to customer sites. I've seen error messages that said "You should never see this error message. If you do, you're in a very bad state." pop up at client sites. This kind of stuff happens, so beware that any test data you enter should at the very least not be offensive - funny is okay, but humour can be in the eye of the beholder. I'm sure the [deleted] police agency would have been happy if the easter egg we joked with at the office (an avi of a pig squealing) had actually made it into the final release so that every time someone hit request-to-talk, that noise played on the laptop. Some officers we showed it to broke up laughing, but I'm sure others would have been hugely pissed off. So whenever you do something you don't think will get out, keep in mind, it on
  • by Paul Jakma ( 2677 ) on Thursday June 16, 2005 @07:10PM (#12836965) Homepage Journal
    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..).
  • Re:10kHz in 1996 (Score:2, Interesting)

    by AKAImBatman ( 238306 ) * <akaimbatman@gmaYEATSil.com minus poet> on Thursday June 16, 2005 @09:46PM (#12837895) Homepage Journal
    Linky [hawaii.edu]

"Gravitation cannot be held responsible for people falling in love." -- Albert Einstein

Working...