3

Let's say I have a source file of 800 lines, and I want to "copy/paste" one function from a github project that has a MIT license, and I also have my own (which may be a MIT license, or a stronger one).

1.- Am I allowed to do the following:

/*
 My copyright notice (MIt or smt)
*/
Line 1
..code
Line.300
..code
Line.500


// At the bottom:
Line.700

/*
 Copyright notice of the code
 taken from that github project
*/
void function()
{
    //... code copy/pasted
}

2.- And if that's allowed, one crazy question: If I take 5 lines of code (and my function is 40 lines long), can I place the copyright notice inside the function (right next to the code copied?).

3.- And last, do I need to change the LICENSE file in my github project for example? even if both licenses are the same MIT licenses?

Sorry for dumb questions, but I have no clue at all.

  • 3
  • 2
    "Let's say I have a source file of 3000 lines..." There's your problem, right there. Break the code up into manageable chunks, put that function in its own file, with its own license header and reference it in the LICENSE file. Job done. – David Arno Apr 23 '16 at 21:41
  • 1
    @DavidArno I wanted to know if I could avoid creating a new file when I just want to copy a very tiny function from a github project that is like 5 - 10 lines long. I do not have 3000 lines long files, it was an example. Clearly a bad one. – Gam Apr 23 '16 at 21:51
  • @Phantom - what's the problem with creating a new file? If nothing else it keeps the imported content apart from your code should you want to keep up with changes in the original project. – James Snell Apr 24 '16 at 17:26
  • 1
    @DavidArno: That comment seems more like a reflex reaction, and is totally irrelevant to the question. – gnasher729 Apr 24 '16 at 22:02
5

Disclaimer: the following is not legal advice. It's only my own personal opinion as IT professional. For legal advice, you should consult a lawyer or a qualified legal expert.

1.Where to put the notice

The copyright notice shall according to US law:

(...) be affixed to the copies in such manner and location as to give reasonable notice of the claim of copyright.

You could put the notice close to the copyrighted functions as you intended to do. But there is a strong risk that this might not be considered giving a "reasonable notice". Imagine someone would copy your file. Immediately at the top he would see your copyright and give you the credit. But would he scroll down 3000 lines, reading them attentively to find out that there is someone else who deserves credit as well ?

This is why the usual practice is to put the copyright notice right at the beginning of the file, and everyone looks there to find out. (Note also that if you'd formally register your software, the process would require you to deposit a printout (or PDF) with the first and the last 25 pages. This reinforces the start of the file as the place for copyright notice.)

If despite of this you'd pursue the way you intend to, you should at least inform in your notice at the beginning of the file, that some parts are copyrighted by third parties, and that the respective notices can be found within the code.

This being said, another easy way to handle it would be to put sections with different copyrights/licenses in different files. Not only will this ease the copyright attribution, but it will also ease maintenance/synchronisation with the original software (aka bug correction).

2.What is protected ?

Not everything is subject to copyright protection. Only original software is really protected:

(..) it is a programmer’s expression of some functionality that may be protected by copyright, and not the functionality itself. If code embodies the only way (or one of very few ways) to express its underlying functionality, that code will be considered unoriginal because the expression is inseparable from the functionality. (...)

And what is not copyrighted doesn't need a license.

But I guess that if you copied/pasted 5 lines and didn't write them yourself, whereas you wrote the 40 other lines, they must bear some kind of originality, which brings us back to 1.

3.The Licence

The MIT license is based on copyright principles:

  • It starts with the copyright notice itself, including the name of the author.
  • Verbatim: "The above copyright notice and this permission notice shall be included (...)"

So if you use a MIT License, the permission notice is the same. But you still need to attribute copyright to the other author. Not mentioning the other authors, or at least that there are other notices for limited parts would not be so fair.

Additional thoughts

Some further reading:

  • This article gives some idea about how to attribute copyright to other authors
  • This article looks at best practice for the copyright notices in open source software projects

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.