4

Is it permissible to, on a specific question, post a requisite that all code in answers must be either under/compatible with a specific license?

Example header text:

All entries are required to be compatible with XXX license. If no license is explicitly stated, it is assumed to be dual-licensed under CC-BY-SA and XXX license.

A little background:

A few of us at Code Golf.SE were planning on cooperatively making a helpful SPA for it, and we were thinking about dividing parts of it into (fastest code/etc.) challenges to post on the site, make it a little fun for our user base in the process. Then we ran into the licensing issue of CC-BY-SA code not compatible with any version of the GPL (among several others). I just wanted to know if that above disclaimer being put on these challenge questions would help alleviate some of these issues.

  • 1
    That code on SO defaults to CC-BY-SA is already dumb enough since that means you're almost never able to include it in your own projects while complying with the license. – CodesInChaos Aug 15 '14 at 7:59
  • That's why the example header text. To override it. I was trying to figure out if the boilerplate can actually change it on a per-question basis from CC-BY-SA. It is more or less a legality question. – Isiah Meadows Aug 15 '14 at 8:01
5

Short version: No, you can't really dictate that others (answerers, in this case) be bound by a license that they haven't explicitly agreed to (like the CC-SA one in the ToS).

So, whatever you write, answerers won't technically be bound by it unless they choose to be.

Longer version: You (and others) obviously can add indications of broader use rights (that don't restrict CC-SA) on your own posts. In theory, I suppose you can have a question that encourages responders to add such an indication if possible to their answer, but I'd stop short of requiring them to.

Some related thoughts on the topic: There's plenty of precedence for explicitly stating a license in regards to code contributed on the site from Stack Overflow. Some folks universally place all code they've contributed in the public domain by giving permission to use and redistribute it under any terms within their profile. Since 'public domain' doesn't exist in some places and you must have a license for something that you didn't write, some go on to write "Or any OSI Approved" license of your choice.

In essence, you (the author) are granting folks the permission to use and distribute your code under the terms of their choice, be they more or less restrictive. If someone wants to use or distribute the code under the terms of the GPL, they are free to do so. In other words, the code just inherits whatever license you're using, if using an OSI approved license.

Hence, a simple:

/* 
 * Additional use and redistribution permitted under any OSI-approved license,
 * provided that distribution in source form provides a link to this post.
 * See http://opensource.org/licenses/alphabetical for a list of licenses 
 * that apply. 
 */

This negates any incompatibility. I could use your contribution under the terms of CC-BY-SA if I'm simply showing your code in my blog post, with proper attribution of course. Or I can roll your code into my GPL, BSD, MIT or even AGPL library if I want. You've given me that flexibility. I can use it in my open source project, I can toss it in my seekrit sauce, it's now up to me. Even the weakest approved license preserves your credit, at least in source form.

You could specify either GPL, LGPL, BSD - but just directing folks to the list of approved licenses offers better options, and (should another license be approved in the future) helps to future-proof things.

It lets you grab a chunk of code and say "This is now GPL2 or later." To be clear, you're probably not doing this in hopes of enforcing a license, you're doing this to be nice to people that might want to use the code. Hence, 'as permissive as possible' is probably your best way to go.

Still, this is just advice - it's your code, so it's ultimately your call.

4

You can post such a requirement, but how would you meaningfully enforce it?

The reason we can enforce the CC BY-SA licensing requirement is because it's explicitly stated under the Stack Exchange Network Terms of Service, which users are required to agree to before using the site. So moderators are empowered to remove noncompliant posts: in particular, posts where the poster actively rejects the CC BY-SA licence, or the content's copyright does not belong to the poster in the first place.

But users aren't actually required to comply with your additional licensing requirement to post an answer to your question, since nothing in the Terms of Service requires that, so moderators aren't going to enforce it.

  • If I can't use that, then how would I be able to use the code in a non-CC'd project (all non-CC0 CC licenses are incompatible with the GPL)? – Isiah Meadows Aug 15 '14 at 11:39
  • 3
    You can very nicely ask answerers to explicitly license their code under your preferred licence (in addition to CC BY-SA, which is mandatory). You'd have to disregard all the answers that don't have that explicit licence, though. – Chris Jester-Young Aug 15 '14 at 11:41
  • Okay. That may work out better. – Isiah Meadows Aug 15 '14 at 11:46

You must log in to answer this question.

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