5

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)?
3
  • You may be very interested in this: Copyright Monopoly Goes Insane: Non-Copy Judged As Infringing
    – user
    CommentedJan 26, 2012 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.CommentedJan 26, 2012 at 16:35
  • @DavidThornley “there are OS licenses for most reasonable use cases, including yours” Like what?
    – s4y
    CommentedJan 26, 2012 at 18:14

6 Answers 6

5

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.

1
  • 3
    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.CommentedJan 26, 2012 at 16:32
2

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.

    1

    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.

    2
    • 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.
      – s4y
      CommentedJan 26, 2012 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
      CommentedJan 27, 2012 at 8:24
    0

    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.

    2
    • 1
      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.CommentedJan 26, 2012 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".CommentedJan 27, 2012 at 0:22
    0
    • 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.

      0

      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.

        Start asking to get answers

        Find the answer to your question by asking.

        Ask question

        Explore related questions

        See similar questions with these tags.