Copyright issues for code excerpts

Typically, small snippets of < 15 lines of code are considered non-copyrightable (according to the FSF’s legal counsel).

If someone posts 100–200 lines of code somewhere, then copying it into your code is indeed a problem if you don’t have an explicit license giving your permission. In the case of discourse.julialang.org, the terms of service explicitly state that contributions are provided under a CC noncommercial license, which is not free/open-source. StackOverflow also uses a creative commons license, and in particular the CC-BY-SA license which is GPL-incompatible and is much more restrictive than the BSD or MIT licenses. So be careful about using anything longer than a few lines!

Update: As of 6 March 2020, the Julia discourse terms of service were updated so that “Source-code user contributions … are additionally licensed under an MIT License”, so there should no longer be any problem in using code posted in this forum.

There are a lot of gray areas here, and you can never be 100% certain what a judge would say, but basically anything that is sufficiently “expressive” is automatically copyrighted. (Fair use gives some other extremely narrow exceptions that allow you to quote someone else for purposes of commentary etc.)

Yes, but you have to make sure you don’t even look at the excerpts and are not influenced by them. Your code needs to pass the abstraction-filtration-comparison test, and you must be able convince a court that you didn’t copy any “expressive” elements of the excerpts.

5 Likes