-1

Specifically in the following scenarios where you're working on an open source library using an incompatible license like the MIT license.

  • You copy & paste a method from a GPL library - blatantly a violation assuming the GPL library created the method themselves.
  • You create a function with a similar purpose but you create it from scratch - presumably not a violation
  • You use the same code as a GPL library, but you improve on it (optimize performance for example) - is this a violation?
  • You use the same code as a GPL library, but you superficially refactor it (e.g. rename variables for clarity, add comments, but don't really change the underlying logic) - is this a violation?
  • You translate code from a GPL library to another language but keep the logic exactly the same - presumably not a violation?

I know these are possibly questions for lawyers but I'm hoping to get a rough idea.

Brandon
  • 5,873
  • 6
  • 37
  • 59

2 Answers2

3

(...) using an incompatible license like the MIT license.

In general, I like to work with this baseline:

  • GPL + MIT => GPL
  • MIT + GPL => GPL
  • (anything else) + GPL => GPL
  • GPL + (anything else) => GPL

In other words, if you mix GPL with anything else, you get GPL'ed code. There are some exceptions, but not at the level of actually mixing code. Note that you can do as you please as long as you keep the code to yourself -- only when you distribute your code you must adhere to the rules of the GPL.

You copy & paste a method from a GPL library - blatantly a violation assuming the GPL library created the method themselves.

Not a violation as long as you release your code under the GPL and quote the original author. This is called a derivative work (one that has all parts but one removed).

You create a function with a similar purpose but you create it from scratch - presumably not a violation

If you see a GPLed program and think to yourself, "gee, that would be useful if it were not GPLed" and the go and write your own program without copying any code and other protected parts, probably not a direct violation. Very much depends on the jurisdiction.

You use the same code as a GPL library, but you improve on it (optimize performance for example) - is this a violation?

As long as you put your code under the GPL that's one of the core ideas of GPL - allow you to improve on the previous work, freely, as you see fit. As long as you stick to the rules, of course.

You use the same code as a GPL library, but you superficially refactor it (e.g. rename variables for clarity, add comments, but don't really change the underlying logic) - is this a violation?

Again, as long as you keep the result GPL'ed and quoting the original author, that's probably fine.

You translate code from a GPL library to another language but keep the logic exactly the same - presumably not a violation?

It's still copying, right? If your intention is to take a GPL'd program in language A and transform it to language B just to get rid of the GPL, think again. That is at least plagiarism, if not worse, in most jurisdictions.

Disclaimer: IANAL

miraculixx
  • 3,103
  • 13
  • 21
  • 2
    There are licenses that are, of course, GPL-incompatible. If a GPL work is combined with a work that is under a license more strict than the GPL, it violates the GPL. You can't combine it with the CDDL, for example. Basically, if it's not on the FSF's [approved licenses](https://www.gnu.org/philosophy/license-list.html) list, it's incompatible. – greyfade Feb 01 '15 at 02:43
  • 1
    Thanks, this was informative, but my question was specifically the rules around modifying code so you can release under a different language. It looks like it's best to just go with a clean room implementation so you'll be in the clear. – Brandon Feb 01 '15 at 02:48
  • 1
    There is one exception to "everything to GPL:" GPL+AGPL => AGPL. – cpast Feb 01 '15 at 02:55
  • 3
    @BrandonWamboldt Whenever he says "keep the result GPLed", it means "GPL copyleft applies to this action." If you use the same code but make improvements, you cannot release under MIT. If you use the same code but superficially refactor, you cannot release under MIT. If you copy/paste, you cannot release under MIT. If you convert to another language and keep logic the same, it's probably better to play it safe and not release under MIT (I think it does trigger mandatory GPL, but I'm not a lawyer; however, if you release under GPL there are certainly no issues). – cpast Feb 01 '15 at 02:58
  • @cpast yes, that's true because AGPL < GPL, i.e. AGPL is essentially a less permissive version of the GPL. However (less permissive) < GPL => (less permissive) is not generally true, otherwise you could have (commercial) < GPL => (commercial), which is not true _at all_ ... – miraculixx Feb 01 '15 at 03:01
  • @miraculixx It's actually true because GPL 3 specifically makes it so; it has nothing to do with how restrictive or permissive things are, it's because FSF liked the AGPL idea and thought it made sense for some but not all software, so explicitly wrote into the two licenses that they're compatible with each other. It doesn't generalize to _any_ other license, whether more or less permissive. – cpast Feb 01 '15 at 03:03
2

You violate the GPL when you do two things.

  1. Create a "derivative work" from GPL'd code.
  2. Fail to follow the requirements of the GPL for creating such works.

You can in fact do ALL of what you noted, so long as you follow the GPL's rules. That's the point of copyleft. You can copy and paste all or part of a GPL'd program into your own, modify it to suit your purposes better, or completely re-write it, and so long as you do what the GPL requires you're 100% in the clear.

If you don't want to follow the GPL's requirements, what you can do becomes far more restrictive. In fact, it becomes exactly as restrictive as what you could do if someone emailed you the source code to some closed-source program, like Microsoft Windows 10.

DougM
  • 6,361
  • 1
  • 17
  • 34
  • **EXCEPT**, of course, if you agreed to follow the GPL as a condition of getting the source code. Then you're in a similar boat as if you went to Microsoft and signed an NDA before uploading Win10 to pirate bay... – DougM Feb 01 '15 at 02:36
  • the fact that the GPL specifically states that you do not need to accept its terms in order to use software covered by it would seem to suggest that even in the situation where you had agreed to it beforehand you would still have some rights to use it in ways that are not explicitly permitted: the GPL *only* applies to distribution, not use. – Jules Feb 01 '15 at 03:46
  • @Jules: I could agree to pay you $ to extend my code and release a GPL'd version. If you don't, I don't need to worry about the GPL, I can just sue you for breach of contract. Even if what you do with the code were fair use, and thus immune to the GPL's copyright claim. – DougM Feb 02 '15 at 16:31