15

I have a very vague impression regarding the GPLv2 license that any project which borrows code from a GPL project needs to be open source too. Now I have a situation that I read part of a GPL project's code and there are around four functions that I would like to borrow for our commercial project.

I converted it into another language and also removed/modify some code in order to fit our project.

Is it illegal?

cHiWa
  • 261
  • 2
  • 6
  • 7
    It might be interesting to note that software companies go through great pains to accomplish what you just wrote legally. The classical example of this is https://en.wikipedia.org/wiki/Clean_room_design – ldog Mar 18 '22 at 21:43
  • I'll not answer wrt the legality, but one question "for a few lines of code; slightly modified" that one always has to ask oneself in practice is whether there is ever any chance that the (possible) copyright violation can be even detected down the line. – Martin Ba Mar 19 '22 at 21:14
  • That should depend on how much "conversion" is involved.

    I guess "… into another language" means into another coding language and I suggest that might give you some kind of joint rights, but never absolve you of a duty to follow the original developer's wishes.

    Removing code to fit your project should make no difference.

    Modify code for whatever purpose, always depends on how far the code is modified

    – Robbie Goodwin Mar 20 '22 at 17:41
  • I'm putting this in a comment because I can't remember exactly whether this is correct for GPLv2, but you could create an open-source library that contains those four functions, link to the library from your proprietary software, and make available the source code for the library. – Nonny Moose Mar 20 '22 at 21:52
  • 1
    @NonnyMoose it is not correct. You might be thinking of LGPL. And why people should not make their software LGPL. – user253751 Mar 21 '22 at 09:45

5 Answers5

28

tl;dr: maybe illegal, trending towards probably illegal. Almost certainly too high a risk for a sensible company to take on.

First things first: open sources licenses allow for commercial use so you can absolutely do this if you are prepared to abide by the GPL for your project. I suspect you are making the common error of using the term "commercial software" when in fact you mean "proprietary software". The rest of this answer assumes you mean proprietary software.

The question is as always "is your code a derivative work of the GPL code?" That is something which is a question of copyright law and will actually vary according to the jurisdiction in which any potential legal action occurs, but as a very rough rule of thumb:

  • If you did a "mechanical" translation from one language to another, similar to taking each line of code and changing it into the same line of code in another language, then your work is almost certainly a derivative work and you must abide by the GPL.
  • If you did a more "hands off" translation, for example just taking the API definitions from the GPL code and making the implementation from scratch in your code, it might not be a derivative work.

However, at this stage it's going to be incredibly hard for you to prove that you weren't influenced (even unintentionally) by having seen the GPL code so I would not be prepared to take the risk. Just find a non-GPL source of the functionality you need and use that instead.

Philip Kendall
  • 19,156
  • 1
  • 57
  • 82
  • 7
    Alternative for the final suggestion would be to ensure that someone else (who hasn't read the same sources) implement the required functionality. I.e. arrange a clean room implementation. – Toby Speight Mar 19 '22 at 08:44
  • 3
    On the other hand, it may also be pretty hard to prove that the code was influenced by the GPL code so much that it is derivative. AFAIK the burden of proof is on the plaintiff. – jpa Mar 19 '22 at 08:49
  • 7
    @jpa In UK law, this would be a civil case and therefore on "balance of probabilities" with no burden of proof on either side. See for example the currently ongoing case involving Ed Sheeran which while about music rather than code is essentially the same thing. – Philip Kendall Mar 19 '22 at 08:54
  • Regarding commercial/proprietary software perhaps the biggest question is whether the product is distributed. If the software is just run on a server there might be no breach at all even if a huge amount of code is copied. – md2perpe Mar 20 '22 at 20:57
  • In the US, Google vs Oracle established a precendent for fair use of APIs outside of copyright restrictions, so I would assume that your second example doesn’t constitute a derivative work (or at least isn’t bound by the orginal licence). – Robin Whittleton Mar 21 '22 at 07:42
  • @RobinWhittleton if your code is similar, you can't prove that you haven't been influenced in this case. Thats why Clean-room design exists. If you just open the GPL code on one screen and write your re-implementation on the second screen, a. it will be heavily influenced by the GPL code and b. you can never prove it wasn't.

    This is just how the human brain works.

    – Josef Mar 21 '22 at 09:25
  • @Josef: Being "influenced" is not the legal standard. The legal standard is "derivative work." Lots of creative works were "influenced" by other creative works. The real problem is not "you might have been influenced," but rather "nobody knows exactly how much influence is enough to qualify." – Kevin Mar 21 '22 at 15:08
  • @PhilipKendall: That comment was directed at Josef, not you. Your answer is fine. – Kevin Mar 21 '22 at 15:13
  • @Kevin if your code is similar or the same (and it will be, if you looked at the GPL code before), and you cannot prove that you didn't have the GPL code to derive it from, you have bad cards at court. If you have a simple problem, like the recursive factorial in another answer, you can give this to a few programmers, there will be some solutions which look like a derivative of each other. If you show them all one solution before, almost all solutions will look like a derivative of this. Clean-room design exists for a reason, and even then you can be sued and could fight for years in court. – Josef Mar 21 '22 at 15:19
7

Adding to the accepted answer, I'd like to point that the answer to your question highly depends on the nature of the function too.

Take a recursive factorial in Java:

public static long fact(long n) {
  if (n <= 1)
     return 1;
  else
     return n * fact(n - 1);
}

Even if you stole this from a GPLv2 project, it's going to be hard for the original author to argue that you did.

IANAL but with any copyright claim comes the question of how "original" the work is. Have you copied functions that are pretty clever and bring a unique solution to a problem? Is the problem solved itself very unusual...? Or is it like my factorial example above?

user1532080
  • 171
  • 2
  • 2
    Re "it's going to be hard for the original author to argue that you did.", That's not the legal standard, at least not in the US. For an exact copy, one doesn't need to prove they actually copied it. One simply needs to prove access to the original. (There are defenses here, and the size will help. There are only so many ways to implement this algorithm...) – ikegami Mar 21 '22 at 17:44
2

Though this question has already been answered, one point has not been addressed. Is your project for external distribution? If not, it's a moot point since distributing the application internally is not "distribution" so it doesn't confer GPL obligations. (Exception: the Affero GPL is a use license rather than a pure distribution license; it considers interaction with servers to be like distribution, so it may confer additional obligations if the project serves clients outside the company.)

piojo
  • 129
  • 2
-1

What's best for everyone involved, including yourself, your career, and the company employing you:

Read the source code. Find out how the source code works. When you know how it works, write it yourself. Without seeing the original source code. That way you are not copying anything, so you are not committing copyright infringement.

If you just take some GPL licensed code and add it to your project, then you have the choice: You license your project under the GPL license, or you admit that you committed copyright infringement and can be sued. If the copyright holder of the GPL licensed source code finds out (how could that happen? Well, maybe your colleague calls them and tells them), not only is your company in trouble, but your career is in big trouble. So you will never do this without talking to your company's lawyer (unless it is common knowledge in your company that the whole product is GPL licensed).

But even if the product is GPL licensed: Many companies use "dual licensing". I can download their source code for free under the GPL license, or I can get a license with full product software for lots of money. If the company does that, they can't just use someone else's GPL licensed code, because then they are not allowed to do dual licensing anymore which kills the business.

So: Don't do it unless you talk to your lawyers. And very often lawyers are expensive, so your boss will tell you not to do it, because it's cheaper you write it yourself, than copying and getting your lawyers involved.

gnasher729
  • 1,265
  • 6
  • 7
-3

One of the stated main intentions of GPL is to force applying it to every project that makes any use of any GPL code. I don't know "the letter of the law", but since forcing you was precisely what was intended and you're asking "Am I forced to?", the answer is "Yes, you're forced to."

  • 1
    The question is really what counts as "makes any use of". There are most definitely things which some people would think of "making use of" which the GPL does not cover. – Philip Kendall Mar 19 '22 at 20:50
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. – Community Mar 20 '22 at 09:13