I have always kind of wondered, but never took my time to actually ask these questions regarding licensing. Most of these questions are presumably pretty basic, but I have no idea what I'm dealing with here.

The thing that baffles me the most is how exactly you "implement" the license for your OSS. Is just saying in the post you're publishing the code on, "by the way, this is licensed under GPL" enough? Or should something more delicate take place, like registering the software somewhere? Also,

  • If I just say I use a particular license, is that enough?
  • Do I add a copy of the license to the distributed code?
  • Am I required to add a header on every file detailing the licensing information? Do I manage this with my version control system (e.g. Subversion)?
  • Is the above not enough?
  • What are the most commonly used software licenses?
  • Are there any gotchas/licenses that are better left alone?

I'm not a lawyer, and this depends on which country you are in.

Having said that, I understand that saying you use a particular license and attaching a notice to that effect within the source code is sufficient. Adding license text to every file is probably over-cautious.

Remember: if there is no license, then someone isn't allowed to copy your code at all under copyright law (with certain fair use exceptions).

Ultimately it's up to the courts to decide. But I think that if you published your source code with the clear intent to offer it under a particular license, a court would agree that the license was intended to apply to the complete work.

If you are choosing an open source license, please stick with one of the major ones. This avoids confusion about unusual licenses and significantly increases opportunities for collaboration and code sharing. In particular, the OSI lists a number of "Licenses that are popular and widely used or with strong communities". I'd strongly recommend sticking to one of these!

  • Apache License, 2.0 (Apache-2.0)
  • BSD 3-Clause "New" or "Revised" license (BSD-3-Clause)
  • BSD 3-Clause "Simplified" or "FreeBSD" license (BSD-2-Clause)
  • GNU General Public License (GPL)
  • MIT license (MIT)
  • Mozilla Public License 2.0 (MPL-2.0)
  • Common Development and Distribution License (CDDL-1.0)
  • Eclipse Public License (EPL-1.0)

The Free Software Federation / GNU project also has some useful pages about open source licensing, including the recommended copyleft licenses.


My apology for being so long but i think this is one such question(s) which bothers first to most people and i didn't quite get a comprehensive compilation of this.

Actually many questions: i am trying to answer one by one.

how exactly you "implement" the license for your OSS

Basically, the minimum need to define the terms of use in the license and put it along with the source. Understand the copy right (essentially authorship) on code is something different from license (to use and redistribute). But given this, you still leave upto the other person to be honest and not miss use the code and violate the license. [More on this later, below].


Perhaps no.

If I add a copy of the license to the distributed code?

Yes. That's perfectly fine.

Am I required to add a header on every file detailing the licensing information? (do I manage this with subversion?)

You don't have to add license information every where. You may have more than one license or change license. However, to identify exactly which all files are covered under the given license declaration, it is important to put your copy right notice everywhere on top or bottom (top is only due to convenience). It's like any other book, with first page printed like Copy Right 2012 - Nico. Nothing else is much needed. See this: Do you have to include a license notice with every source file?

or should something more delicate take place, like registering the software somewhere?

There is no concept of registration with any license. If you have provided the license along with the code, only if there is a dispute,

What are the most commonly used software licenses?

I think the answer of mikera does a good job here so i won't repeat.

Now for the most intriguing (and implied) question:

So how do you enforce? How do you ensure that people don't violate the license and don't lie! After all it is too much to ask for that from people when already the code cannot control itself?

The simple bad news is - you cann't quite do that with a mechanism like lock-n-key. Even if you believe that you can put someone in the court to bring judgement, each court has a jurisdiction (area of influence) and you might need to fight all people everywhere. Even if you have time and energy for this, you need to prove that they have indeed taken your code and violated! That's almost hard to do given that your code is available from the source.

Don't get upset. There are things you can do. It all depends on the context and purpose.

  1. First off, you want to open your code for Open source usage, so you are typically fine (and want) that people use for your code.

  2. Suppose, you want people to use your code for tinkering or research but pay for the commercial use, you can have dual license.

  3. In general, if your code is well known in the industry - people who will tend to use your derived code - should also typically known to you. For example, given that ffmpeg is so famous - if anyone would claim they have a new codec to offer me i would put a ref check to see if they are not just compiling and giving me. So potentially people wouldn't violate if you are a known player in the industry. This is also another point why being on GitHub or SourceForge to distribute code makes sense (apart from the tools they help you with).

  4. If you know the market well - you can actually check that someone is using this library, you case use - tool like strings that can produce object trace and can pickup your variables, routines name, enough to know that your code is being copied. This is possible to outsmart though, but might just work in some cases. Of course, there is a theoretical limit to attain justice if people change all lines of code still keeping the logic - there is an interesting read here: Is it possible to rewrite every line of an open source project in a slightly different way, and use it in a closed source project?

  5. Another funny measure (if you genuinely know someone is using your code and violating) - ffmpeg keeps what is known as Hall-of-shame as a public listing on who is violating their their license.

  6. Last but most critical - what if another open source take your code, wrap it up and make it freely available with a license that permits arbitrary commercial usage? May be the same group with another use will start using this in their own product. For this, you need strong license like GPL or MPL.

  7. Another such issue is, what if someone actually use your name and do something that becomes harmful to society and you end up being on the wrong side of the court? For this, you need at least No warranty clause (and also sometimes no patent infringement clauses).

  8. If you have more complex needs you can do dual license. It's not complicated as much but out of scope from this answer. There are good answers on this subject on this very forum.

I think at this stage, if you have quite a bit of curiocity - just read a different clauses of these licenses, you can have some good understanding about it. I am not a lawayer, and most such question in P.SE are answered with i-am-not-lawayer tag; but they are not so obfuscated either - you can actually read the text and make quite a sense out of it. Once you read this, it might clear many of your doubt.


Commonly used licenses:

Typically, you will need a file called COPYING or LICENSE which includes the full-text of the license. Each file in your project should have copyright information and should say that the project is licensed under a particular license.

Most licenses include some boiler-plate text to include at the top of each file that's part of the project. The GNU project has a page explaining how to do this with their licenses.


What I do, which appears to generally be the standard, is to create a file called COPYING in the root directory of your project containing the license code. You should also create a file called COPYRIGHT in the same folder as the other file and include something like this (written in Markdown since most distro sites like that):

<name of your project> <version>
<short description of the program>
Copyright <major release years, e.g. 2006-2010> <copyright owner>
<the boilerplate text typically at the bottom of most licenses>

You could also call this file README and add any other info you want to pass along with your program. Finally, if you use a short license like the BSD or the MIT, don't add the COPYING file and simply use the full license instead of the boilerplate text in the README or COPYRIGHT file.

APPENDIX: The weird guy is the LGPL. You need to include both the GPL in the COPYING file and the LGPL in a file called COPYING.LESSER, since in the eyes of the law the LGPL is an extension onto the rights of the GPL.

Your Answer

