I wish to quote some code that was released under the GNU Public Licence 2 (or at user's desire, a later version) but I am aware that content published here is to be licensed with a (modified?) MIT licence. Does this mean I cannot reproduce that code here and can only refer users to it with a URL?

It was my intent to indicate how I used the code (which is a C header file) to use the API that it documents so as to interface with the software in the package that it is a part of.

Update: following a detour into the currently Beta Open Source SE area I found:

which seem to suggest that I would have a problem in reproducing a complete header file on the main site which was my original intention as that would mean I was reproducing GPL material that SE would be attempting to re-license under their terms and as I was not the copyright holder/original creator this is not permitted. As a UK citizen my position under its Wikipedia Copyright Law entry is merely more confusing especially as it is not clear whether that even applies here!

2 Answers 2


Possibly the definitive answer to this is to be found on Meta, but rather than dig around I'll make a quick distinction:

  • "I wish to quote some code..."

  • "content published here is to be licensed with a (modified?) MIT licence"

These don't refer to the same event.

If I write a paper for publication somewhere and cite someone else's work properly, I am not publishing that other work. It's already published. I'm citing it. In this case, WRT "citing properly", I'm pretty sure the terms of the GPL are such that you can do this and simply include a link to the source, which should contain the licence, acknowledge the author and copyright, and you're okay. You are not claiming the work as your own and you are not (re)publishing it for re-distribution.

It's not unusual for academics of whatever level (and book authors) to cite GPL'd code and they do not need to get permission to do this any more than they'd need to get permission to cite and analyse any author of any kind of published work.

So your post would be covered by whatever licence Stack Exchange uses -- if there's no original code, that would just be the Creative Commons thing, I guess -- and the code you cite remains covered by the GPL, which allows you to cite it as long as you include a link to the source.

Likewise, although I can't remember seeing an example or discussion of such, I am sure you are free to cite your own GPL'd code on S.O. and ask for help with it whilst saying this is already published under the GPL without worrying someone is going to lay MIT type claims to it.

  • That does seem to clear things up a bit - but with a little proviso in regard to your "Likewise..." paragraph: I was intending to publish my code, eventually, also under GPL2+ - but I haven't yet done so does that queer things at all?
    – SlySven
    Jan 1, 2017 at 17:53
  • Well, it doesn't take more than a minute or two to slap a license and copyright on your own code. I dunno if there's some subtle distinction there though if you haven't published it by making it publicly available. That might be a good one to ask on Open Source Beta, or you could try the variation, "Can I explicitly include a different FOSS license on code I intend to publish that way?" on Meta.SE, or, since it probably isn't more than 100 lines or so, just let it slide on the fact that you are free to include your own MIT code in your own GPL code.
    – goldilocks Mod
    Jan 1, 2017 at 18:01
  • Well if it is my code I can licence it as I see fit! Good thought about opensource.stackexchange.com I forget that I registered on there in the past and it threw up some counter arguments.
    – SlySven
    Jan 1, 2017 at 18:10

In general, under copyright law, you are free to copy portions of material for limited use. Like a teacher making a limited amount of copies of an article for a class. Or pulling out segments of code to pass around to this limited audience for comments on those sections.

What you cannot do, even under GPL, is publish the entirety of their work under your own name. And you certainly cannot sell it as your own work.

My Answer: Yes, you can quote segments of code with the purpose of gaining more understanding of how to use it in your own work.

  • "And you certainly cannot sell it." -> I think WRT most FOSS licenses, certainly the GPL, you can sell it, and keep all the money, as long as you don't violate the other terms (claiming it as your own, etc.). This is common practice for Pi distributors, who sell SD cards with Raspbian on it. They may or may not donate some of the proceeds to the Raspbian organisation, but they are not required to do so, anymore than Raspbian would be required to pass that on to Debian, etc.
    – goldilocks Mod
    Jan 2, 2017 at 23:17
  • True enough. I made an edit that hopefully clarifies what I meant. btw, I heard that they are going to come out with a version of Raspbian (NOOBS) that will work on an Intel PC. I don't know if it is in a virtual machine or what. But I do know it will not include Mathematica due to those kinds of royalty restrictions.
    – SDsolar
    Jan 3, 2017 at 2:43
  • You're in luck, at least WRT Raspbian: raspberrypi.org/blog/pixel-pc-mac Looks like it's really "Debian + PIXEL" but that's all Raspbian is anyway.
    – goldilocks Mod
    Jan 3, 2017 at 12:22
  • That's great. Downloading it now. TNX
    – SDsolar
    Jan 3, 2017 at 19:45
  • It works great in Virtualbox, with Run with Persistence. I save the machine state also. Pretty cool. Now I can test install things and revert to the previous state without having to shut down, pull out an SD card, and restore a saved image using Win32DiskImager. This way my working units don't have to have any downtime. Thank you very much for the link.
    – SDsolar
    Jan 3, 2017 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .