Using Open Source Code

This page assumes an advanced knowledge of the way that programs are built in a production environment. Fear not! I have written another page that tells you everything you need to know about the subject. If you are not a programmer, or even if you are, but you just write a few simple VB scripts for your own use, you should check it out before coming back here. I urge you to do so, the stuff there is even more important to understanding how Open Source works than this page is.

Open Source and Closed Source

Traditional shrink-wrapped software is closed-source. A purchaser never sees the source-code, and is often forbidden from reverse-engineering the object code to recreate it. The producer's argument goes something like this. Complex software takes many man years of effort to produce, but only seconds to copy. If I cannot claim money from every user of my software then I wont recoup the investment that I have made in producing it, and my competitors could learn all my secrets and produce a better product.

With open source software the purchaser always has access to the source code. In most cases they can modify that source code and distribute those modifications to others. Traditional software vendors tend to view open source software in much the same way as a grocer would view someone giving away free vegetables. Either that someone is stupid, or they are using unfair market tactics to put the grocer out of business. However the open source producers see things differently. They have found that all software is produced to fill some need. Even if the software is free that need is still there to be serviced, and money can still be made from it. With more people having access to the source code the program can be made more powerful faster than with closed source. So open source software out-competes closed source software, and the companies providing it acquire the service industry along with the market share. In addition, open source empowers the customer and creates community; a great PR and CR win.

There are many different licences for open source. All of them have been developed to maintain control over the source code to different degrees and for different purposes. It is important to realise that not all licences are as successful in producing community and empowerment as others, and it is largely community and empowerment that creates the advantages that the producer hopes to enjoy.

The Extent of Copyright

When Brian Kernighan and Dennis Ritchie were writing their book on the C language, they needed a simple program as a starting point. Here it is:

	#include <stdio.h>
	void main ()
		printf ("Hello World\n");

How much of this program is copyrightable? This much:

	Hello World\n
Copyright is limited to work with a creative input, that is not affected by a limited number of ways that it can be produced. Any C program in the world has to have this:
	void main ()
There are only a small number of ways that a message can be displayed on the screen, and using printf is the most obvious. If we use printf then we have to #include <stdio.h>, we have (almost) no option.

I wouldn't like to infringe Kernighan and Ritchie's copyright, so I suppose I better fix it.

	#include <stdio.h>
	void main ()
		printf ("Hi Everybody\n");
OK, now we're safe from all copyright problems.

That doesn't look like much of a change. Most of the program is absolutely identical, but all the identical bits are not copyrightable, and we've changed everything that is.

Our new program has the same functionality as Kernighan and Ritchie's original. It still displays a greeting to everyone and does nothing else, so isn't that going to be a problem? Cannot Kernighan and Ritchie claim that I just translated their program a bit and that copyright therefore still holds?

There are only a limited number of ways to say "Hello World," and I couldn't think of one that doesn't have the same sorts of words in the same positions. That means that the basic layout of the message is obvious; our new version doesn't infringe copyright.

That's worth saying one more time. It isn't copyrightable if it doesn't require creative input or it can only be done in a few different ways. Consider this line of source code:

	FLAG_VALUE = 1876
The value 1876 is nothing special, it has no creative input. Therefore it is not protected by copyright.

The idea of a program that prints out a greeting to everyone and does nothing else, even one thats entire purpose is pedagogical is theoretically protectable. However copyright does not protect ideas, for that you need patents. Could Kernighan and Ritchie patent the Hello World program? Well they could have done, if they had bothered to spend a few thousand dollars when they first wrote it. But that was in 1978, and the maximum lifetime of a patent is twenty years. So even if they had, it would have lapsed by now.

Third Party Packages

Of course the programmer will not have written all of the code that is used in any program. In our Hello World program we didn't write the libc library, that is provided for us. So our runnable program contains code that is copyrighted by a third party. We have to ensure that we are legally allowed to do that, and the only way to do so is to read the licence. Of course any library is going to allow that sort of thing or it would be fairly pointless, but we must be aware of the limitations or we could end up in hot water. For example, the third party might require any of the following:

  1. We pay a royalty for every instance of every program containing the third party code that we distribute.
  2. We may distribute programs containing the third party code, but the person that receives them may not.
  3. We may distribute programs in runnable form, but we may not distribute the third party code in any other form.
  4. We may distribute the programs in any form, but we must offer the complete source code along with it.
Notice that some of these requirements contradict others. If we use two different pieces of third party code, and one requires that we distribute the complete source code and the other says that we can not do so, then we have a big problem. One of those pieces of third party code has to go. It doesn't matter which one; we could ditch the first and only distribute runnable code, or ditch the second and distribute the source code. Of course we might have our own preference for choosing one or the other option.

Open Source Libraries

There are many different variations on open source licences. In the main if you are writing open source code and using open source libraries then they are transparent. You can do what you want. On the other hand, if you are writing closed source code (ie only distributing the runnable program) then you will have to pay close attention to the licences. Many of them will let you do this without any problems, but others wont.

Open Source Tools

Programmers use many programs in order to create every program. In copyright terms these programs modify programs, translate them, and form derivative and collective works.

So how does that affect copyright? In most cases it doesn't. Very few of the programs put any of themselves into the files that they produce. So long as the programmer has the right to use all the source code and object code in the program, using these tools does not create any new requirements or limitations, even if they are commercial programs, public domain programs, open source programs or GPL programs. The programmer can use them in perfect safety.

Some tools do inject something of themselves into your program. In such cases you will probably find that their licences allow you to use this part of the program as if it were a library.

But most of the time it is perfectly possible to create even closed-source programs using nothing but open-source tools and libraries without any copyright or licencing problems whatsoever.

Open Source Programs

Usually the only problems occur when you have a program that is expected to stand-alone, but you want to use it as part of another project. Say your project is crying out for a word-processor, and rather than write one from scratch, you want to take an open-source word-processor, take off the bits that make it a stand-alone program, and embed it inside your program. Can you do so? You have to check the licence carefully. In some cases it would also be a good idea to check with a lawyer and ask the copyright holders of the program.

If you are writing an open source program with a compatible licence then your only problem will be stepping on people's toes. You should consider if your program might just be a modification of the original program, in which case its maintainers might like you to donate the changes to their project. Or they might like you to craft the interface between your program and theirs so that other people could do the same sort of thing in the future.

However if you are writing a closed-source program then you could end up in court. It is possible for a closed-source program to use an open-source program but there are hoops to jump through to do so, and no legal precedent on which to rely. The GPL FAQ gives more detail on this subject.

The GNU General Public Licence

The GPL has only one requirement: if you distribute the protected code, or any derivative of it, then you must also offer to supply the complete source code. The GPL is, and should be, only used for complete programs. Libraries use the LGPL (Lesser or Library GPL), which relaxes this requirement.

The GPL is a beautifully crafted pure licence. There is no contract facet to it, so you do not have to enter into any sort of agreement to be bound by it. This is how it works:

The GPL has been around for twenty years. In that time it has never gone to court, because it was seen to be watertight by the defence's lawyers. Note that in order to beat the GPL a defendant must not only prove that the GPL is an invalid document, they must also prove that they have a right to distribute derivations of someonelse's work. One does not follow easily from the other. If I found a book lying on the ground it does not enable me to distribute derivatives of it; the book is still copyrighted.

This year may see the first two tests of the GPL in court. It is not expected to fail. As I write this an interim injunction has been granted in Germany on the basis of the GPL.

Is the GPL Viral?

Say you wanted to use Microsoft Word in your own program. Could you do it? No. Not without Microsoft's lawyers jumping on you. Using GPL programs is exactly the same; just because you got the source code free does not mean that you can do anything you want with it.

What happens if you suddenly discover that you have been distributing, with your closed-source program, a program that you thought was OK, but turns out to be GPL? First you kick yourself for being so stupid. Then you talk to your lawyers. You are guilty of illegally distributing a derivative of someonelse's copyrighted work. You have lost the right to distribute that work under the GPL, but you weren't doing that anyway. At the very least you need to rewrite your program not to use the offending work. It would probably be a good idea to talk to the copyright holders and plead your case. They are not going to be pleased. If the case goes to court you may have to pay damages, and you will be forbidden from using the GPL'd work in the future.

Note that I did not say that your closed-source program is now GPL. It is not. It is always your option to use the GPL or not. Of course if you remove the offending code your program might be non-functional, leaving you with no product to sell, but that's your fault; you broke the law. Try that one on the movie studios: "I know the movie is derivative of ET, but I need to sell it or I'll go bankrupt." If you need your product, and your product needs that GPL code, then you might have to obey the terms that the copyright holders lay down, and those terms might include releasing your product under the GPL. That's your choice: do you need the product that badly? You don't need to follow their terms if you don't need their code.


I am not a lawyer, nor a citizen of the USA. I am merely a fallible, informed observer. Everything on this page should be read with this in mind. All trademarks and copyrights are the properties of their owners.

Ambercon UK 04Ambercon UK 05Ambercon UK 06Ambercon UK 07Ambercon UK 09Ethereal Add-onsPrior ArtUsing Open Source geek quiz

Translations in Copyright

The translation of a program from source code to object code is treated by copyright law exactly the same as when an English book is translated to French. The object code is subject to the same copyright as the source code.

Derivation in Copyright

In (USA) legal precedent, a software program is only derivative of another if it includes parts of the other within it. Those parts must themselves be subject to copyright law. With books and movies the matter is more involved, but with software it devolves to simple textual copying.
Ambercon UK Diceless rople-playing in four star luxury.
Ambercon UK Diceless rople-playing in four star luxury.
Ethereal For an open-source, world-class network protocol analyser.