I am facing the following dilemma at the moment. I am using code from a scientific paper in a commercial project. So basically I copied and pasted the code from the paper's pdf into my code editor and use it in my own code. The code in the paper does not have any copy restrictions or license(like the GPL) so I thought I would be ok using it in a commercial project.

However, I have seen several gpl licensed open source projects that use the exact same code from the paper to the point of having the same variable names like in the paper. So what happened here is that a gpl license was put on a third parties non gpl'ed code.

Are these open source projects in violation of the gpl or would I be in violation of the gpl because I use code which has been gpl'ed? My common sense tells me it is not allowed to gpl somebody elses non-gpl'ed (like in this case from the paper) code but I though I would ask anyway.

  • 3
    The other projects may have asked the paper authors directly before assigning a license to the code. IFF the code was prepared by a US federal employee in the course of their job, no copyright may be asserted on the code, so there may be some leeway if that's the provenance of the code. The easy answer is to Just Ask The Authors. :) – sarnold Feb 28 '11 at 2:04
  • 2
    Since the paper is apparently not GPLed by the original author, I can't see how you could be violating the GPL. The fact that some third party has used it in a GPLed program is irrelevant to you. Disclaimer: IANAL. – user281377 Feb 28 '11 at 7:40
  • 1
    Aside from the various remarks made here (some a little snarky, some not), it would appear you have a course of action: 1. Contact the author of the paper and find the legal status of the published code. If its free-as-in-public-domain, then you can ignore the GPL clones. If not, then CONSIDER re-implementing the algorithm, which of itself can't be copyrighted. (And IANAL). – quickly_now Feb 28 '11 at 10:16

On what basis are you asserting that "The code in the paper does not have any copy restrictions or license"?

Without a license, published material falls under standard copyright law. In most countries, this means that all rights are reserved to the owner of the copyright (usually the author of the article or the publisher of the journal). While there are exceptions (which vary by country) that may permit legal usage of extracts, they're unlikely to extend so far as wholesale verbatim lifting of code.

(Even though the algorithm itself cannot be copyrighted, the particular expression in terms of choice of variable names, comments, code structure is subject to those laws)

So there is a fair chance that both you and the authors of the GPL modules you mention are violating the original author's copyright, unless they have genuinely released it under a permissive license. If they have done that, then redistributors can use whatever license they like.

As Dean Harding suggests in the comments below, a good place to start would be to contact the original authors of the paper to check the license on their code. If they're happy to explicitly provide it under a liberal license, both you and the GPL projects are likely to be fine (it is possible to violate the liberal licenses, but it's typically also fairly easy to remedy a breach even if you do make a mistake).

If you have the funds, another thing to do would be to find yourself a good copyright lawyer and ask them your licensing questions (preferably looking for one that understands open source licensing and can help with the tangled jurisdictional issues that can arise when making and distributing software online). Taking that action will count in your favour if you land in legal hot water further down the track. Note that I am not a lawyer, and even if I was, this still wouldn't be legal advice (since you wouldn't technically be my client).

  • 4
    +1. the problem here is "The code in the paper does not have any copy restrictions or license" which is a misconception of copyright law. The default for unlabeled materials is "All rights reserved" (you CANNOT copy, redistribute, OR modify) rather than "public domain" (take it and do what you want). – Havoc P Feb 28 '11 at 3:22
  • 1
    you wouldn't be my client. What does that mean? – Robert Harvey Feb 28 '11 at 3:44
  • 3
    Oops, that wording really didn't make my point clear. Advice from a lawyer to their clients has a special place in the law. When you hire a lawyer, that official relationship is one of the things you are paying for. So, when discussing legal issues on the net, you'll see two common disclaimers: IANAL (I Am Not A Lawyer) and IAALBIANYL (I Am A Lawyer, But I Am Not Your Lawyer). – ncoghlan Feb 28 '11 at 7:12
  • 2
    I would recommend contacting the author(s) before you contact a lawyer. It's much cheaper that way :-) – Dean Harding Feb 28 '11 at 11:24
  • 1
    The trouble with "hire a laywer" = where? In your country/state, in the country/state of the author, of the journal publisher, Of the university they work at, in all the countries you intend to distribute the software? Might be cheaper to ask the author for permission - or reimplement in the algorithm in your own words (math's can't yet be patented!). – Martin Beckett Feb 28 '11 at 16:59

The copyright holder gets to decide how the code is licensed. Generally speaking, someone else cannot come along and change the restrictions of a piece of code if they are not the copyright holder.

In your example, the non-GPL'd code that has been copied into the GPL'd project will typically be handled in accordance with the GPL (because it is code that is inside a GPL project), but you can always treat the non-GPL'd portion as if it were not GPL'd, since you can always obtain that code separately with a non-GPL'd license from the original author.

  • 1
    An explanation for the downvote would be nice. I'll readily agree if I'm wrong, but I don't see any way under any current legal theory that someone can just arbitrarily change someone else's copyright conditions. – Robert Harvey Feb 28 '11 at 3:42
  • 1
    I'm curious too. Your answer is right. +1 – jmort253 Feb 28 '11 at 4:38
  • 1
    you're right except that you apparently see little wrong with taking someone's code that has no explicit license mentioned and releasing it under GPL. Which might be the reason someone downvoted your answer. – jwenting Feb 28 '11 at 7:32
  • Except in this case the OP can not get the code with a non-GPL'd licence - he can't get it with any license at all! – bdonlan Feb 28 '11 at 11:59
  • OK, well I think we've all made the point. The code needs to have an actual, non-restrictive license; without that, the OP has no explicitly-stated use rights. I assumed that was the case since the OP explicitly stated as such (he says that the code he got from the paper has no license like the GPL). – Robert Harvey Feb 28 '11 at 15:24

Consider also the possibility that the code expressed in the paper was not properly attributed to its GPL roots. While it's certainly possible that there are GPL projects that have co-opted code from a paper that doesn't give it a clear license, the reverse is similarly true. And it's just as possible that the code originally hailed from a source that allowed both uses.

Unless you know the true source of the code (which in the absence of copyright violations will have to be the most permissive source), you cannot truly assess how to treat it.


If it has no license, then it has copy restrictions, and you may not use it, since then copyright law applies unmodified. In that case, the GPLed versions are the most free to use, assuming they're legitimate.

There's a common practice of assuming that published code is free for the taking, but that isn't true unless there is a license that allows it. Without a license, it's look but don't touch. (This is why I believe everybody who publishes code should be clear about its licensing and the use they want made of it.)

If there is no license, ask the author about using the code. Most academics are happy to see their code actually get used, although there are exceptions. The author may have already granted licenses; if you've seen the code under the GPL, either the author allowed that, or somebody has done something wrong (either the author neglected license statement and attribution or the people using the GPL took the code without permission).

In general, any free/open source code that can be incorporated into a proprietary/closed source product can also be incorporated into a GPLed product, so seeing the same code under different licenses is legit. Just make sure you copy from the right source.

  • "In that case, the GPLed versions are the most free to use, assuming they're legitimate." GPL is anything but free. It's the most restrictive license you can release your code under, in that it greatly restricts what can be done with anything that even gets close to the code even in compiled form. Things like the APL are a lot more free. – jwenting Mar 1 '11 at 7:28
  • @jwenting: I take it you've never read a proprietary code license. – David Thornley Mar 1 '11 at 14:35

For the few people actually answering the question I was asking, thank you.

I guess the gpl is just like software patents, everything has been patented or gpl'ed at some point. So the best thing for me to do is just ignore the gpl like software patterns are ignored generally.

Edit: Why can't I don't downvote answers? I am the author of this question. For example, the answer of ncoglan does not address my questions and makes no sense at all yet it is at the top but I can't downvote it.


Interesting, interesting. When I read the answers and comments above I see that for example if I had written the program forloop.c many years ago which looks like

for( int i = 0; i < N; i++)

and give it the GPL license or no license at all and publish it on the internet then most software written after that would be in violation of my license terms because most software uses a for loop.

I guess I will just have to treat the GPL like software patterns. Everything has most likely been patented or gpl'ed at some point so the best thing to do is just to ignore software patents and to ignore the gpl.

  • No you could simply have reimplemented it using the same variable names! But if it had been patented then the very idea of using a loop and checking the end condition wouldn't be allowed. It's good idea that some Hindu mathematician hadn't patented place value! – Martin Beckett Feb 28 '11 at 17:45
  • Yeah, just like I own the copyright on the text "Do something a certain number of times", which is actually 10 characters longer. – Gareth Davidson Feb 28 '11 at 18:31
  • 2
    At least in the US, there's things you can't copyright, like the natural expression of an idea. It's only possible to copyright things that require at least marginal creativity. If a chunk of code is copyrightable, you're unlikely to write the exact same thing by chance, and you can certainly avoid writing it. – David Thornley Feb 28 '11 at 19:17
  • 1
    this is just wrong. you can't copyright that. – Havoc P Feb 28 '11 at 23:42
  • 1
    As David said, there's a certain level of creativity needed for code to quality as copyrightable. Short functional snippets don't qualify. – ncoghlan Mar 1 '11 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy