Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In many projects these days most of the novel code consists of glue code that helps combine dozens of different libraries, plugins and helpers that are licensed under a variety of open source licenses.

In many cases the licenses are fairly obvious as they carry the name of the license in the license file or comment. In others this is a bit harder and requires memorizing certain wordings to tell the more common licenses apart.

I am wondering: Is there an easy way to recognize particularly the very similar licenses (say, MIT/BSD-2/BSD-3) without having to memorize complete license texts or check out the OSI copies as reference?

share|improve this question
1  
I'm probably missing something here, but why is this a problem? You need to know at least the name of the license, and on every project I've used that wasn't hard to find. –  Yannis Rizos May 5 '12 at 12:16
    
File comparison tool? –  MarkJ May 5 '12 at 12:57
    
Related/possible duplicate of: programmers.stackexchange.com/questions/105344/… –  Joey Adams May 5 '12 at 13:19
    
grep? extra characters because I have to but I shouldn't even need to make this comment. –  Rig May 5 '12 at 13:31
1  
If I understood correctly, the OP is talking about the (very common IMO) situation where a bunch of code has only a file generically named "LICENSE", with no indication of which license it is except for its text. Of course, if you're scanning those files programatically, grep or something similar is the answer, but since the OP mentioned "memorizing" I believe he's doing it manually. And as Jeff Atwood pointed out, it's very common to find code "in the wild" that doesn't clearly state its copyright status. –  mgibsonbr May 5 '12 at 14:09
show 4 more comments

1 Answer

Just use the most powerful pattern matching tool you have at your disposal: your eyes. I ran into the same problem some time ago (was compiling a big list of Django apps and jQuery plugins, and most of them didn't explicitly name the license they were using), in the beginning I had to compare to a reference text all the time, but it didn't take long for me to become able to identify those licenses in a glimpse. Here's what I see when I look at the MIT license:

Copyright (C) <year> <copyright holders>

Permission is hereby granted, text text text
text text text
text text text

The above copyright notice and this permission notice text text text

TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT

And the Modified BSD:

Copyright (c) <year>, <copyright holder>
All rights reserved.

Redistribution text text text
* text text text
* text text text
* Neither the name of the <organization> nor the
  text text text

TEXT TEXT TEXT
TEXT TEXT TEXT

Notice how the text layout combined with a few key words/phrases are enough to identify those two licenses, and since they are by far the most common (that don't display its own name in the header, like the GPL or the Apache) they're easy to memorize (and obviously, I can tell it's BSD-3 because it has 3 bullet points).

Now, it's always possible - though very unlikely - that the authors used a slightly different license that you could mistake for the MIT/BSD-3, but if they did and they care about the difference, you can reasonably expect them to call attention to it.

Update: check this answer to a SO question about "grepping" a page using JavaScript; maybe with a little work one could write a small tool (a bookmarklet for instance) to search the contents of a page for the text of a license among a small set of known ones (written as a regex, since you'd have to replace the <copyright holder> and such for wildcards). I avoid bookmarkets because of the security implications, but if you either wrote or is hosting (if applicable) them yourself you should be fine. I know no existing tool for that purpose though.

Personally, I don't think it's worth the trouble - the effort to carefully examine a license is only a small part of the decision to incorporate it into a big project. Usually the troublesome parts are the library dependencies, or the relative effort to integrate them with the rest of your code. So I prefer to do a quick classification into "might use" or "definitly won't use" and then, if I decide the library is really promising, take a closer look at the license.

share|improve this answer
2  
So you're saying rote memorization (of the general layout at least) is currently the only way to recognize them? That's what I feared. I'm working with Django apps and jQuery plugins in this case, too, btw. But I've seen licenses in the wild that seem very similar to MIT, BSD, etc, but contain minor modifications (say, the JSON license, which is not compatible with the GPL). –  pluma May 5 '12 at 17:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.