A while ago, I encountered an edit suggestion on Stack Overflow. The OP had posted a snippet that was under the GPL, and included the GPL in the snippet. The editor tried to remove the GPL as it was not relevant to the question.

From an SE point of view, this makes sense - as an SO user, I don't want to see licenses, just the code that the question is about.

Is it legal to remove the license this way, assuming the snippet is a non-trivial piece of code?

  • Was the snippet authored by the person posting it, or was it a third party snippet? Commented Aug 9, 2015 at 15:56
  • @Svartepjotr I think it was authored by the OP. But I'd be interested to know if this kind of thing is OK when the OP isn't the author of the code. Commented Aug 9, 2015 at 16:00
  • 1
    Related: Can I "Override" a licensing policy?
    – Zizouz212
    Commented Aug 9, 2015 at 21:03

3 Answers 3

  1. If the code snippet is is authored by user, then adding the GPL just means that it is dual licensed under the GNU GPL as well as CC BY-SA (the default licence applied to all content posted on SE). This was mighty helpful of the user, as it would otherwise not be possible to reuse that snippet in any program not licensed under CC BY-SA without finding it elsewhere under GPL.

  2. If the code snippet was not authored by SE user, and the code was was not too trivial to be uncopyrightable, and its original licence was GPL, then posting it on SE would put it under CC BY-SA. However, only the original author can do this, so such an action without permission from the copyright owner would be unlawful.

  • 1
    "then posting it on SE would put it under CC BY-SA" -- or rather, it wouldn't put it under CC BY-SA (because the person posting has no legal ability to do so). Therefore unless there's "fair use" the poster is breaching firstly the GPL (by redistributing without the license) and secondly the terms of the site (by posting without being able to grant the necessary licenses). Furthermore the site is unknowingly in breach of the GPL by redistributing without the license. Again, unless there's fair use. Commented Aug 10, 2015 at 18:16

If the code snippet was actually just a snippet, then you could see it as a citation of the original source code and as long as the citation was necessary to enable people to comment properly, it may fall under Fair Use. Since Fair Use is an exception to copyright coverage, the license would not matter much in this case as long as the source it publicly available. Countries that do not have the concept of Fair Use in their copyright legislation sometimes have specific exceptions for citations.

It is hard to judge if it was clearly just a citation without seeing the actual post.

  • I refrained from linking the actual edit suggestion to focus on the more general case, and to avoid drawing undue attention to the post itself. If we need a specific example, I can still edit it in. Commented Aug 9, 2015 at 18:53
  • 6
    @S.L.Barth Fair Use is tricky and treacherous. It would all depend on the context, and even then we wouldn't be able to give a conclusive answer; it's always for the court to decide. That said, if the post was critiquing or commenting on the snipped, it's likelier a fair use defense would help than if the post was offering the snippet as a solution. Context matters a lot in fair use.
    – Martijn
    Commented Aug 9, 2015 at 21:51

This was contrary to the T&C of stackoverflow.

You agree that all Subscriber Content that You contribute to the Network is perpetually and irrevocably licensed to Stack Exchange under the Creative Commons Attribution Share Alike license.

The author granted a CC license whether or not they posted a GPL notice. If the author lacked rights to grant that license, the whole post is invalid. So either the GPL goes, or the post goes. So, it's legal insofar as, under the T&Cs of the site, posting the code granted the CC license, and so the GPL notice was misleading noise.

If the author not only added the GPL notice, but clearly stated that his or her intent was to dual-license both GPL and CC, then it would be reasonable, if kind of pretentious and noisy. But if the impression is that the OP is trying to avoid the CC license in favor of the GPL, it's no go.

Meanwhile, some legal experts apply de minimus to small software snippets. On the other hand, if the author is specifically claiming the snippet as a copyrighted work, it's probably not a good idea to pick a fight.

  • It is actually very helpful to dual license the code if the person asking the question (or anyone else) intents to use the code in a GPL software. This would otherwise be illegal or at least a grey area. For exactly this reason all my code snippets are dual licensed with CC0 (see my Profile)
    – Josef
    Commented Aug 10, 2015 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.