Let's say I am working on an open source project and want to re-use a trivial utility function from another open source project (for example, a file search/replace function). Is it legal to copy the function and simply write a small copyright notice in top of the file? Should I include their name as copyright holders of the entire project in the license?

Similarly, let's say I fork an open source project. Where and how do I specify that the copyright is shared between both the original copyright holder and myself?

I guess the answer must somewhat vary according to the open source license but I'd like a general answer as much as possible.

PS: I'm mostly concerned about the legal aspect, but feel free to include your ethical point of view.

  • 1
    What is the license of the project in question, and the project you are releasing? Yes, you can use the code, but please be more specific so that we can better inform you of your requirements under the license that is being used.
    – user131
    Nov 29, 2010 at 12:39
  • 1
    @Tim Post: It's mostly a theoretical question but if it can help let's suppose both projects have a GPL license since it's very common. Nov 29, 2010 at 12:46

1 Answer 1


I'm trying to make this answer as 'meta' applicable as possible.

Using snippets / bits from other projects

Clearly mark the code with the original author's copyright. Make sure that your license of choice is fully compatible with the license of the code you are using. You will need permission of the author to move the code to a different license (unless they specifically allow you to do so, I.e. "GPL 2 or any later version")

Your program should have an AUTHORS file (or similar), where you list all contributors and things that you used from other projects.

Forking a project

For each module that you substantially change, add your copyright under the original author's. The same thing goes for licensing, you are bound by the terms of the license that was in effect when you forked it. If the project says "GPL2 only", you must respect that, you can't go to GPL3 without their permission.

This varies, greatly, depending on the license at hand. The QPL says you can only distribute changes in patch format, for instance, so make sure you understand the terms that allow you to distribute modified versions of the software.

Beyond that, always preserve copyright. If adding your own copyright to what exists, be sure that you clearly mark exactly what you are claiming.

  • 1
    You can, sometimes, add licenses. Suppose you wanted to use a BSD function in a GPLed project: you can't remove the BSD license, but it is compatible with the GPL, so you can issue the whole project under the GPL and note that the function is also under the BSD license. It would be polite to release any changes you make to BSD-licensed code under the BSD. Nov 29, 2010 at 15:21
  • @David - The OP wanted a generic answer (hence my urging to research the licenses). You are quite correct. HOWEVER, it is 'nice' to dual license any changes you made to the BSD code, so the original authors can actually use it if they want it.
    – user131
    Nov 29, 2010 at 15:50
  • 1
    At what point should the main license file have your copyright notice above the original authors'? When your SLOCs exceed 200% of the original project SLOCs? 300%? If the project you forked ends up being one of many librares or modules within your project?
    – hobs
    Apr 4, 2013 at 18:04
  • @hobs imo, order of copyright notice is not an indication of the magnitude of contribution, but rather details chronologically the origins.
    – user22018
    Nov 21, 2015 at 12:16
  • @TechnikEmpire Chronological order makes sense, but for a contributors list rather than a copyright notice? I thought copyright notices might be better arranged according to the sections of code they apply to and the value/quantity of those sections in the package. It's useful to have a list of the people you need to contact, in order of priority, if you want to change something about the license. So if you get permission from the first few, but not the last, you have a smaller amount of code to recreate if you are determined to make the change. I wonder what Linus does?
    – hobs
    Nov 23, 2015 at 20:39

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.