3

It is common for open source projects to have a LICENSE file containing (obviously) the project's license.

It is however also common for open source projects to copy said license in each file of the project (usually at the top).

I don't understand the point of doing this; surely if a file doesn't specify another license then the project's license applies (otherwise what's the point of a project-wide license file), making it pointless to copy it hundred of thousands of times across the project. I'm assuming I'm missing something, probably a legal gotcha, or maybe project-wide license files have no legal meaning and are just informal hints and the license must be specified in each file? Hence my question here:

Why would we copy the project's license (in the LICENSE file) to each file in the project? What would be legally different if we didn't?

(I would've assumed someone else asked this already, but I haven't found anything)

2
2

You have copyright in the code you write automatically, from the moment you write it (you don't specify a jurisdiction, but this is true pretty much everywhere). Copyright notices are placed to put any reader on notice of this fact, and to provide them with information about who owns the copyright.

Once you have written the code you can allow others to copy and use it by providing them with a license, meaning a set of permissions that you choose to give them. As long as it is clear what is being licensed and under what terms there is no problem.

The practice of putting a copyright header (not license terms) at the top of every file emerged as standard practice some decades ago. It doesn't have any particular legal rationale; it is simply a reasonable compromise between space and notification. Putting a comment saying "This file is part of the Foobar Library © Joe Bloggs 2017" also helps to clearly define what files the license covers (along with other things such as grouping under a common folder and distribution as a single zip file). The question of whether a particular file is part of the licensed work is a matter of fact, not law.

If a dispute of licensing and copyright gets that far, a court will take notice of standard industry practice and expect that the parties will be aware of it. So since a file called "LICENSE" in the top level of the project directory is standard practice for licensing terms, that would be considered to have put any recipients on notice of the terms of the license. Putting a reference to the file in the header comment is so simple and cheap that its probably a good idea, but failing to do so probably wouldn't affect a court case.

So in conclusion you are correct: copying the entire license text to the top of every source file is pointless; it gets you nothing that usual practice would not do.

(Personal anecdote: back in the 80s my employer sent a lawyer round to explain to us the importance of putting the actual © symbol in our source code: the "(c)" convention apparently didn't cut it. In vain did we explain that ASCII didn't include a copyright symbol so he was asking the impossible. His attitude was that he had done his job in explaining the law, and now it was our job to sort out the technical details.)

1

There, actually, is an official answer to your question

You should put a notice at the start of each source file, stating what license it carries, in order to avoid risk of the code's getting disconnected from its license. If your repository's README says that source file is under the GNU GPL, what happens if someone copies that file to another program? That other context may not show what the file's license is. It may appear to have some other license, or no license at all (which would make the code nonfree).

(I highlighted two half sentences)

1
  • "official" as far as GNU is concerned - not a legally airtight type official answer. – George White Aug 7 '20 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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