64

Many licenses, such as Apache 2.0, have both a long and a short form. Typically, the long form is included in the repository as a single LICENSE file, and the short form is used in the actual source code.

But, if you include the LICENSE file, is it actually necessary to include another copy (short or long) in every source file?

What about files which do not actually have a way to add comments (such as conformant JSON files)?

5
  • 2
    You should take in account local laws also, in my country's case, law requires every source file to include a copyright notice
    – E. Celis
    Commented Jun 24, 2015 at 3:21
  • 2
    JSON files are often just data, and may not be copyrightable at all. See: Feist Publications, Inc., v. Rural Telephone Service Co..
    – user38
    Commented Jun 24, 2015 at 15:27
  • @ecelis What country is that? It would have to be one of the few countries that haven't ratified the Berne convention. Commented Jun 25, 2015 at 0:51
  • @Gilles México, which is part of the Berne convention and all other related international treaties. But this copyright notice I talk about is not like the "All rights reserved" notice, it states who owns the code and who else shares part in authorship and maybe ownership also. In this text you can also grant or deny usage. As I said, local laws should be reviewed.
    – E. Celis
    Commented Jun 25, 2015 at 3:28
  • 1
    @ecelis Mexico doesn't require a copyright notice, copyright exists regardless of its presence. This has been the case for about half a century. See e.g. olivares.com.mx/En/Knowledge/Articles/CopyrightArticles/… Commented Jun 25, 2015 at 10:01

3 Answers 3

30

For the Apache 2.0 License, there is both the legal code, and what you need to "apply" the license to the work in question.

Having a license file provides the legal code. That's great, but it doesn't tell me the specifics... does that license really apply here? When did the license take effect?

The Apache page goes on to instruct you how to place it in your work, that you need to place the information to "apply" the license, and continues providing details and even a template.

The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.

For pages which don't have commenting support, I think it should be fine to even have the information in a basic .txt file, as long as people know what it is. If it helps, give it a filename such as json-license.txt It may help to have additional information in that file (e.g. Why the license... Probably not that but you get what I mean)

Ecelis also points out two links that provide some more information about where to place the licenses:

0
16

I'm not aware of any jurisdiction that has a law that explicitly states that a license notice must be included in each file, or conversely that it need not be included in each file.

In all countries that have ratified the Berne convention, all works are subject to copyright, whether they include a copyright notice or not. (A copyright notice may help, especially when seeking damages, but it is not required.) Absent a license, someone holding a legitimate copy of the work may deal with it in most ways (use it, modify it, etc.) but may not redistribute it. So if the license cannot be found, that's to the detriment of the recipient, not of the author.

The main risk if a file has no license notice is that the author A provides a user B with a complete multi-file work including a file stating the license terms, and B redistributes (lawfully, assuming an open source license) a single file to C without conveying the license terms to C. In this case, assuming a license that requires further distribution to be under the terms of the same license (which is the case for many open source licenses), C has not received a lawful copy of the work, since B's distribution to C would be a violation of the license. This is to the detriment of C, because they would then in principle not allowed to use the work in any way, lacking a lawful copy.

Including a reference to the license in each file makes it more likely that in such circumstances, C will be properly informed of the provenance and the license of the collection of files. It's a good idea, but there is no strict legal requirement.

Including a copyright notice in each file is also not required, since copyright is automatic as explained above. However it can be a good idea because a copyright notice can, in some cases, be circumstantial evidence of authorship and may allow the author to claim more damages in case of copyright violation.

One more bit that is often lumped with the license is a warranty disclaimer. That one's of a different nature, because unlike the bulk of the license, the warranty disclaimer protects the author. Warranty on works covered by copyright (such as software) is a bit of a strange beast — traditional law considers works covered by copyright to be artistic, not functional, and thus not subject to warranties. I'm not aware of jurisprudence regarding warranty statements on software, but it'll have to happen sooner or later. It's not even clear that typical warranty statements on software (whether open source or not) have any legal effect. However, if in doubt, this is one that you should include, since it protects the author if it's at all valid.

2
  • Worse user B copies the file into a project with many other files and distributes that project to user C. User C then makes the reasonable but potentially incorrect assumption that the copied file is under the same terms as the rest of the project. Commented Nov 23, 2018 at 17:09
  • "C has not received a lawful copy of the work" This is not completely correct. More robust licenses usually has a clause covering this case, such that the receiver still is licensed to use the work under the original license.
    – Max Xiong
    Commented Sep 16, 2020 at 3:21
9

It is recommended in many places, including by the license writers, to include the license header as well as the license file. Some reasons for this are:

  • it clearly demonstrates what the license applies to
  • it points to the full license

The license file itself can then contain solely the license, without having to list everything it applies to.

1
  • 2
    Useful answer, but it would be even more useful if "recommended in many places" could be backed up by some actual references. Do you by any chance have any links to articles stating this?
    – wovano
    Commented Sep 6, 2021 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.