The question Is it illegal to rewrite every line of an open source project in a slightly different way, and use it in a closed source project? makes me wonder what would be considered a clean-room implementation in the era of open source projects.

Hypothetically, if I were to develop a library which duplicates the publicly documented interface of an open-source library, without ever looking at the source code for that library, could that code ever be considered a derivative work?

Obviously it would need the same class hierarchy and method signatures, so that it could be a drop-in replacement - could that in itself, be enough to provoke a copyright claim?

What about if I used the test suite of the open source project to verify whether my clean implementation behaved in the same way as the original library? Would using the test suite be enough to dirty my clean code?

As should be expected from a question like this, I am not looking for specific legal advice, but looking to document experiences people may have had with this sort of issue.

  • 4
    Since many open source projects work the other way round - creating an open source implementation of a proprietary API - it would be a clear case of double standards to dissallow a closed-source implementation of an open-source API. – user281377 Jun 24 '11 at 16:29

To your question about the test suite: if you're simply "using" the test-suite against your own code, and not distributing it with your code for validation, you're fine. With almost every open source license (possibly all) you are free to "use" it as you see fit. The regulations only come into play when you're creating derivative works or redistributing it.You cannot possibly get in trouble.

Besides that, how can they PROVE you ran a test suite against your code without your admission? Just because your code conforms to an interface, does not prove you validated it with their test suite.

  • On your second point, they might be able to prove that you (or at least someone from your IP address) downloaded the package that contained the test suite, which may be enough depending on local laws. However, since tests and source are often distributed together, they would do equally well arguing that you could have looked at the source code too, and thus that might dirty your clean implementation. – Mark Booth Jun 27 '11 at 9:42

That is pretty much what Microsoft has done in the development of IronRuby. They were very careful not to ever look at Matz's code or even hire developers that were familiar with the MRI or YARV code bases to avoid risk of litigation.


If you do a true Clean Room on the code itself, I don't see any problems here. Using the test suite to test something other than the code it was originally designed for should be a non-issue because there are no limitations (I'm guessing) on whether you can do that or not.

In a lot of ways, this is how Linus got started -- he read the public APIs and docs and then started coding.


Okay, I'm not a lawyer, this isn't legal advice, consult a lawyer before relying on anything I say here.

In the US, you can't copyright functionality. If something is the only possible expression of an idea, or must be copied to achieve a practical goal, it isn't copyrighted. An API is purely functional in this sense; it must be copied to use a library.

It is entirely legal under copyright law (not necessarily patent law) to write code to a specification.

The GPL restrictions apply to incorporating GPLed code into other software, not to the use of such code. You can use a test suite as you like, although you might not be able to compile it in and distribute. Similarly, you can use emacs to develop proprietary software.

  • +1 for "Similarly, you can use emacs to develop proprietary software." – Daniel Pryden Jun 24 '11 at 18:19

If you really want to know for sure, drop an email to the Software Freedom Law Center, describing your situation and the license used by the open source project you're interested in.

But it's my understanding that even the most "infective" licenses, like GPL, permit this kind of use. For instance, the gcc compiler itself is GPL, but just using it to compile your code doesn't "infect" your code with being open-source.

Your Answer

