19

I have noticed a few times that people have edited link only answers to include code taken from the linked site. However, anything posted on stack exchange is licensed under the Creative Commons Attribution-ShareAlike 3.0 license, but code on a linked site may have it's own license already.

Not being the copyright owner of that code can we really post it on Stack Overflow and re-license it? Or in this case is a link-only-answer actually the correct answer? Sure you can still write context around a link but it may be impossible to include the actual bit of code which answers the question.

Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.

Update: Examples of sites which are commonly linked to which have licenses for code examples:

The point is not whether the code is open source or not or whether people have a right to use the code. The point is that it is not licensed under the CC BY-SA license which is being applied to it. Indeed in most cases the code is licensed under a more permissive license which isn't viral.

And back to the point of link-only-answers, there seems to be a lot of talk about how bad they are (which I mostly agree with) and how to deal with accepted link-only-answers but no one has talked about the potential license issues of including the actual answer in the answer rather than a link to a page which contains the answer.

Update: Other relevant questions to do with licensing although they don't consider link-only-answers.

Why doesn't SE use a more permissive license like the Creative Commons Attribution license? Would really put a lot of people's minds at ease and not leave things to come down to whether something is determined to be fair-use or not which is not so clear cut.

9
  • It appears I was mistaken in my answer, but I'd like to see why: should we treat a few lines of code to be licensed, even if they just express a common solution to the problem? I mean, there are many similar codes that solve the same question. If we rewrite the licensed code, therefore sometimes changing only names or structure a little bit would we call it an infringment? If not, why not post the original code?
    – 3yakuya
    Commented May 14, 2014 at 1:06
  • @Byakuya Those with less than 10K rep cannot see your answer that you mention; but why delete it on Meta? There is no reputation to lose. Downvotes on Meta often simply mean that people disagree with what you've written. Commented May 14, 2014 at 1:08
  • Not much about the rep, if I still believed my answer. It's more like I consider myself to be mistaken once my answer goes -2 or below.
    – 3yakuya
    Commented May 14, 2014 at 1:10
  • 3
    But now you're asking for feedback in the comment of the question! You should undelete the answer, and edit it to ask for feedback there instead. Commented May 14, 2014 at 1:10
  • 2
    Aren't excerpts legally allowed for educational/review purposes? Commented May 14, 2014 at 2:27
  • @JeroenVannevel I think there are fair use arguments for excerpts yes. However posting anything on stackexchange is specifically adding a license to the content of that post.
    – kjbartel
    Commented May 14, 2014 at 2:37
  • The exactly mirrored question of If I use SO code on my website, how should I give attribution?. What applies there for others has to apply here for us as well. Commented May 14, 2014 at 14:30
  • @JeroenVannevel Not sure about the legal freedom of educational. Our license CC BY-SA allows commercialization of the content, otherwise NC would need to be added. Commented May 14, 2014 at 14:33
  • 2
    CC licenses are not recommended for code anyway, as per their own FAQ: wiki.creativecommons.org/…. The only exception here is CC0, which is a public domain dedication or a legal emulation thereof. Commented May 14, 2014 at 14:57

3 Answers 3

6

IANALNDIPOOT. But I love talking about this sort of stuff.

Stack Exchange operates on good faith - they trust that you have the rights to post what you've posted. If someone can show that something should not have been posted, the Stack Exchange team will ensure it is removed.

As for the actual legal niceties, this is where blurred lines happen - well they don't really but it's tricky enough that it looks blurred to most except for the lawyers making money off it.

The answer is that there is no absolute answer.

but code on a linked site may have it's own license already

In all but a very tiny miniscule number of cases that licence is for the productive use and distribution of that code (i.e. how you may distribute binaries built from it, the changes you may make to the code, etc.). It is rare that an author who has published something openly on the internet will have a condition that outright prevents it being displayed elsewhere. Any condition or licence of this nature is dubious in worth because it is a civil demand that is superseded by local laws and international treaties. If someone openly publishes some code it is because they either a) want to show off, or b) want others to study it. Republishing reasonable parts of that arguably fits within the author's intended terms of use.

Before anyone melts down over this analysis refer back to my third and fourth paragraphs above, and remember that none of this is absolute. Also remember that the whole world wide web is a great big copying machine - it relies upon local copies of content in order to work. Fundamental banning of copying of anything on the internet makes it totally useless. Can you see how messy this gets?

Not being the copyright owner of that code can we really post it on stackoverflow and re-license it?

This is where it gets tricky. You are not relicencing the source - the cc by-sa licence applies to the text of the post. The aforementioned treaties and laws allow a certain amount of reuse of a published work without penalty - this is so published works can be referenced and excerpted within reason.

None of this prevents a copyright owner from requesting a takedown of published work they have an ownership claim over.
It also doesn't stop an aggrieved party trying to sue your ass for as much as they can - that's the way this stuff works. It also doesn't stop people making stupid mistakes and publishing code they had no right to publish - which is also not directly Stack Exchange's problem.

11
  • 26
    That's "I am not a lawyer, nor do I play one on TV", to save people the Google.
    – Charles
    Commented May 14, 2014 at 4:45
  • 4
    I think you are mixing copyright and licensing which are two different things. You may reuse and publish copyrighted work for fair use circumstances but you may not apply a license or change the license of that work which is what is happening to everything posted on SE.
    – kjbartel
    Commented May 14, 2014 at 4:57
  • @kjbartel Nope, not mixing them up, simply answering your question (note the direct quotes, you've mixed the terminology). Also note the bit where I say you are not relicencing the source, what we are doing by taking an excerpt is exercising rights under Copyright.
    – slugster
    Commented May 14, 2014 at 6:02
  • 3
    No, taking an except and publishing it is exercising your rights under copyright. That's copyright. But publishing it on SE is assigning a license to that content. So if that work already has a license then this act of publishing it is re-licensing that excerpt. Licenses may only be applied by the copyright owner. Note that some licenses do grant you copy rights and thus you may relicense the work as long as you follow the rest of the licence. You can't copy a bit of code give it a new license and then claim fair use under copyright.
    – kjbartel
    Commented May 14, 2014 at 6:25
  • @kjbartel You are not relicencing the code. The cc by-sa covers the text of the post you write (i.e. the content). It's real basic, go and read it.
    – slugster
    Commented May 14, 2014 at 7:45
  • 2
    Everything you write in SE is content. Everything! All contributions: the entirety of questions, answers and comments, including explanation and.... any source code snippets. If you're trying to be funny and saying that source code is not code... well good for you. But all cases I know of the licenses apply equally to source and compiled binary code. Perhaps you should go and read it since you think it is so basic: "user contributions licensed under cc by-sa 3.0 with attribution required".
    – kjbartel
    Commented May 14, 2014 at 7:56
  • @kjbartel Clearly what I'm saying is not getting through, and by your arguments it is quite unclear exactly what sort of answer you are after. Even after your edit you still use the term fair use which usually applies to copyright, not software (code) licence. Please either stop arguing incessantly (this is not a discussion forum), or completely rework your question to make it clear (I understood your question, I just think you don't understand my answer).
    – slugster
    Commented May 14, 2014 at 8:03
  • 2
    @slugster the cc licenses themselves include the term "fair use". And clearly others on this site like Jeff Atwood thinks code on SO is licensed. Why exactly do you think that code is not licensed under the clearly stated cc by-sa 3.0 license? People are asking for answers to questions which are often in the form of code snippets. And I do understand you answer: you are arguing that displaying code is not the same as distributing it. Well you are flat out wrong.
    – kjbartel
    Commented May 14, 2014 at 8:32
  • 1
    @kjbartel For the last time: there are multiple things in play here. The excerpted code is not being relicenced because StackExchange and the post author don't have the right to do that. If the post author was also the owner of the code then arguably cc by-sa could be construed to cover just that excerpt (i.e. just the content of the post as previously stated). Is that what you were looking for? I never said displaying wasn't distributing, I said open publication pretty much nullifies any clause preventing source distribution. You haven't understood my answer - at least not fully.
    – slugster
    Commented May 14, 2014 at 9:59
  • This question maybe old, but has arisen again. The statement above, "I said open publication pretty much nullifies any clause preventing source distribution" seems like nonsense. Much is published on the web, such as online newspapers. You can't just copy chunks because you like them. Specific uses are allowed - parody, quoting for critical commentary - but AFAIK copying a chunk because it's good is NOT. And copyright can exist in units as small as a couple of words the US, for example. Commented Jul 22, 2018 at 17:35
  • Hi @StuartWhitehouse I was unaware of the new issue. Try not to take one individual point and make a new discussion out of it - this stuff is too complex for that. Based on a quick read of your comment I'd suggest that you've confused copyright with licensing. To repeat: IANAL, but if you use copied code in your application (you've repackaged it) then that is a licensing problem, not a copyright problem. Copyright has fair use provisions, licensing is a problem for lawyers and courts to sort out. Copying the plunks to SO is a copyright question (it's republished, not repackaged).
    – slugster
    Commented Jul 23, 2018 at 11:14
0

No, you obviously may not copy code from an external site to SO if it is not published under a compatible license.

8
  • 1
    So what's a compatible license? As far as I know only the copyright owner may assign a license to their work so the only compatible license would be the cc by-sa license itself.
    – kjbartel
    Commented May 14, 2014 at 2:16
  • @kjbartel, MIT, BSD, Apache Commons are three that come to mind as being very open and permissive. You can pretty much do whatever you want with code licensed under those terms. Commented May 14, 2014 at 5:56
  • @jmort253 Yep. But any code posted to SO under those licenses would then be dual licensed and technically you'd have to include the copyright notice and license for any "substantial portions of the Software". Could you imagine every answer on SO including links to or full text of license files just so they contain the complete answer?
    – kjbartel
    Commented May 14, 2014 at 6:11
  • @kjbartel - Not necessarily. There's fair use clauses, and most Stack Overflow code snippets are small enough to fall under that category. If they're not, then the question probably wasn't a good fit for Stack Overflow and should be closed and/or deleted. See Jeff Atwood's answer regarding this issue. Hope this helps. Commented May 14, 2014 at 7:04
  • @jmort253 It is indeed interesting. More-so are the comments to his answer and indeed one comment with a link to an answer to another question. I think also that Daviud Thornley's answer is another point to consider. Seems all rather grey to me still considering it all comes down to whether something is considered fair-use or not. I guess a lot of it could be cleared up if SE used a more permissive license like the cc by license.
    – kjbartel
    Commented May 14, 2014 at 7:33
  • 1
    @kjbartel - It is sort of a grey area, and I get what you're saying. I just try to make it a habit of always using code that's MIT licensed (or BSD, Apache, etc). If a Stack Overflow answer has a link, I do check it out. If it's proprietary or GPL (the leftist side of proprietary) I generally keep searching until I find an alternative, or I simply derive inspiration from the solution and write it myself. Commented May 14, 2014 at 7:42
  • If this is so obvious, then why is there so much debate about copyrights out there in the world? and in this question?
    – PlasmaHH
    Commented May 14, 2014 at 14:28
  • 3
    @jmort253: Fair use allows YOU to use small excerpts in your work. It doesn't give you permission to post that work under a license which allows further use of the excerpts. I do not believe that any SO post actually can claim a fair use copyright defense. When you post, you assert that you have authority to grant a CC BY-SA license to all content, and if you've excerpted someone else's work, you don't have that authority for that part of the post.
    – Ben Voigt
    Commented Nov 12, 2014 at 21:33
-2

You could try writing your answer in prose, not code, expressing in your own words the ideas set forth in the code. Providing an explanation in English has two advantages over just pasting Teh Codez: it helps the asker understand better, and it's less likely to be viewed as an incompatibly licensed (that is, infringing) derivative work. Then cite the code as a source. New users who run into the 2-link limit can use the linkless citation workaround.

This becomes doubly important on January 1, 2016, once Stack Exchange sites switch to the MIT License for new code contributions.

You must log in to answer this question.

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