Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I tried to answer a question related to the open source Apache Portable Runtime Project.

I found the answer to the question in the sources (in this case, the test cases) of the project. The project is under a APL 2.0.

Since the OP uses the project, the license is probably OK for them but the license isn't compatible with CC-Wiki (SO's license).

An answer to this question says:

The cc license cannot, and does not, override the terms of an existing license.

So the code fragment is still under APL even though I posted it here. So I added the link to the license plus the license header.


  1. Is it generally OK/correct/legal to post code from OSS projects on SO?
  2. Are there OSS licenses which specifically forbid sharing via SO?
  3. ... or which can cause other unintentional trouble (like posting GPL code here would make SO GPL'd or something)?
  4. Is my way of posting correct / too much (maybe the license is enough and I could omit the license header) / not enough?
share|improve this question
This is why I hate lawyers – Ben Brocka May 8 '12 at 15:42
Seems silly they would put a license on their test code... – user7116 May 8 '12 at 15:57
The license is for all the code in the project. And why would they select a different license for tests? – Aaron Digulla May 8 '12 at 16:21
@AaronDigulla: because there is no reason to license tests or samples. – user7116 May 8 '12 at 16:27
@sixlettervariables: Are you sure? Did you ask a lawyer? ;-) – Aaron Digulla May 8 '12 at 16:29
@AaronDigulla: I work for a company which would consider variable names to be proprietary information. – user7116 May 8 '12 at 16:34
You sure you are allowed around here? Or is a security detail already on its way to "handle" you ;-) – Aaron Digulla May 8 '12 at 16:35
up vote 11 down vote accepted

If you're going to post the whole source which is under a given license, then yes you should ensure that the license is well known to any viewer of the answer. This is not incompatible with the CC-Wiki license.

If you're going to post a snippet or small section--keep in mind I am not a lawyer--then I would believe you are covered under fair use. Furthermore, you should attribute the source the snippet so as to not violate the spirit of either of the licenses.

However, you probably should not be posting the entire source in an answer (unless it is trivial). Enough of a sample to get the questioner going in the right direction is fine and preferred over copy-pasting an entire file.

share|improve this answer

You must log in to answer this question.

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