Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

On a fairly regular basis, I run into problems that have already been solved by open source projects.

Let’s say, purely for the sake of example, that I’m adding functionality to a piece of open source software which lets it line wrap some information in your terminal. It needs to know the width of the user’s terminal to do so.

libuv (Node.JS’s platform layer) has already solved the problem (under *nix and Windows!) (so have a number of other projects, FWIW). It turns out that libuv is licensed under something which looks suspiciously like the MIT license:

Copyright Joyent, Inc. and other Node contributors. All rights
reserved. Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Is there a right (legal and respectful) way to use the window-sizing logic from libuv in another project? Here are the options that I can think of:

  1. Nothing is required, since this doesn’t constitute a “substantial portion of the Software” (but including attribution in the source code would be nice).
  2. A full copy of the license should be included in the source code.
  3. A full copy of the license should be included in the source code and distributed with binaries.

Bonuses:

  1. What if the destination project is closed-source?
  2. What if the borrowed code gets modified heavily (now or in the future)?
  3. What’s the best way for authors of open source code to encourage reuse of bits of it by other programmers, with reasonable restrictions (e.g. require attribution in the source code, but don’t require the license to be distributed with binaries which include it)?
share|improve this question
    
You may be very interested in this: Copyright Monopoly Goes Insane: Non-Copy Judged As Infringing –  Michael Kjörling Jan 26 '12 at 13:28
    
First, you can always adhere closely to the license when you're in doubt. Second, there are OS licenses for most reasonable use cases, including yours. Third, if you're trying to do anything that isn't clearly legal, programmers.se can't advise you. Get a real lawyer familiar with appropriate laws in your jurisdiction. –  David Thornley Jan 26 '12 at 16:35
    
@DavidThornley “there are OS licenses for most reasonable use cases, including yours” Like what? –  Sidnicious Jan 26 '12 at 18:14

6 Answers 6

Looking at source code and writing something similar to do the same thing in much the same way is not a breach of copyright. The copyright applies strictly to the text of the source code.

So I am not allowed to cut and paste Agatha Christie's text and publish it as my own, but, I am quite free to write a murder mystery where the victims are all traveling on a sleeper train, and a clever foreigner solves the mystery.

share|improve this answer
    
Don't be too confident. An early software plagiarism case found that copying the structure of a large software system was infringing, even if all the code was rewritten. That's one reason for clean-room implementation: to make sure the new code is written in a way that provably doesn't infringe. –  David Thornley Jan 26 '12 at 16:32

How big/complicated is the code? If it's not that complicated, I think it's fair to learn the logic and write your own implementation.

share|improve this answer

Difficult to give any one true answer.

If you break a lump of code down into small enough parts, pretty much all of it is not special at all.

Taking this to the logical extreme, are you going to worry about a license for:

thing = thing + 1;

IANAL - but I don't think you can take any answer given as being completely right because there will be cases where it will be wrong. (In the above, define "substantial". Its a subjective term).

What you do will come down to your judgement.

share|improve this answer
    
It may not be your judgement, but rather a court's. If you're trying to do anything against the spirit of a license, talk to a lawyer. –  David Thornley Jan 26 '12 at 16:33
    
In my experience, talking to a lawyer will lead to 2 answers: "Well I don't really know." Followed by "Well I suppose you could try X but its up to you really". –  quickly_now Jan 27 '12 at 0:22

The proper solution is cleanroom reverse engineering. Copyright applies to lines of code, not ideas. If you therefore have one person extract the idea from the original code and write it down, and another person re-implement the idea from paper, then you have a paper trail showing that you did not break the copyright.

This method has been tested and accepted in court.

share|improve this answer
    
If cleanroom reverse engineering is the solution to sharing small bits of logic between open source projects, something is very broken with either the way code is licensed or the way I understand software licensing. –  Sidnicious Jan 26 '12 at 18:16
    
@Sidnicious: It's one way, and a very safe way. For projects that are under sufficiently compatible Open Source licenses, you can indeed copy code directly. –  MSalters Jan 27 '12 at 8:24
  • Ask Google and Oracle how do the think about copying some snippets for Android.
  • Ask Karl-Theodor zu Guttenberg (German ex Minister of Defence) how big a snippet must be until you have to mark it as an citation.

Really this is much to complicated to answer it in general. And to my understanding to be really correct, it depends at least on the local laws of your country.

share|improve this answer

There are two questions:

  • When is the copyiright affected?
  • What to do, if it is?

The easy question is No. 2, what to do, if it is: You have to stick to the rules of the copyrighted software. There is no "for a small piece, I only stick partly to the license". It is either/or. If your action does not affect the copyright, you have nothing to do. Of course you're free to write an email to the author of a software, and ask for permission to use a short piece of code. If this is to much work and to slow for some few lines of code, rewrite them from scratch.

What constitutes a copyright infringement is much harder to decide. It may differ from jurisdiction to jurisdiction and even from judge to judge and case to case. When in doubt, rewrite it from scratch. If you can't write it from scratch, it is a copyright violation, that's for sure.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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