Some open-source programs have a single copyright and license notice in the README file, while others put a notice in each file in the program.

I prefer the first practice because it makes the code more succinct. But I wonder if a central notice is good enough to cover all the files in the program because some licenses allow users to freely copy and modify files in the program. If a user only copies some but not all the files, then those files may lose their trace to the copyright and license notice. In this case, is the user obliged to attach the copyright and license notice to the copied files?

This is not a great idea, for the reasons you have noted. Taking the specific question first

is the user obliged to attach the copyright and license notice to the copied files?

It depends on what the licence obliges them to do. Some do require preservation of existing notices; some do not.

As for best practice, the GNU GPL advises people wishing to release software under it to include a single copy of the entire GPL, and at the beginning of each file insert a copyright notice, and text like

This file is part of Foobar.

Foobar is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3, as published by the Free Software Foundation ... You should have received a copy of the GNU General Public License along with Foobar. If not, see https://www.gnu.org/licenses/.

I have trimmed the text to keep the question manageable, but it only runs to three substantive paragraphs, and is of course not mandatory in form. So best practice is to put a copyright notice and some reference to the choice of licence in each source file.

None of this is an absolute requirement, but presumably you're publishing freely to maximise the use of what you write, and one element of making something maximally usable is the minimisation of doubt about how it can be used ("What's the licence on foobar anyway? Did this file even come from our copy of foobar? Stuff it, let's just write our own baz() call.")

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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