14

I'm writing an eBook (perhaps to be published physically one day) on the topic of programming. As such, it contains many coding samples. I want to expressly allow readers to copy the source code of code samples for their own use, and I feel no need to require them to give me attribution in their compiled output--I don't need a byline on some corporate web site, just because somebody copied 300 lines of my code.

On the other hand, I also don't want somebody to copy some or all of the source code, and redistribute it solo, or with their own text, as their own.

My ideal would be something that requires attribution only in source form, but not in compiled/binary/object form. I believe this would accomplish both of my key goals mentioned above. Something like the MIT or 2/3-clause BSD license would be fine with me, except that I don't need it to apply to the compiled program.

Are there any existing open-source licenses that would apply to such a situation? Or should I just stick with a well-known MIT/BSD-style license, even though it covers compiled output?

I can, of course, write my own, but since IANAL, I'm sure I'll screw something up, and end up with a worthless license.

  • What do you want to happen if I take you code, compile, run it through a decompiler and post the output? – Philip Kendall Jul 11 at 12:18
  • @PhilipKendall: I don't really care about that case. – Flimzy Jul 11 at 13:17
  • FWIW, it's unlikely you will find a license that does exactly what you want. You may have to modify an existing license by adding additional clauses. Boost (already mentioned in an answer) is probably the closest, but likely does not require the source to be redistributed with the text unless you license the whole book under it (which would preclude you from effectively making money off of it, and may lead to some interesting side effects). Also, it's unlikely that you'll find any license that does this type of thing without requiring attribution. – Austin Hemmelgarn Jul 12 at 12:49
  • @AustinHemmelgarn: I don't understand why you think the entire book needs to be released under the same license. There's no requirement that a derivative work of a Boost-licensed work is also Boost-licensed, for the Boost license to apply. – Flimzy Jul 12 at 19:17
  • 2
    The issue I see is that you want the source to be redistributed only together with the rest of the book. Actually achieving that in a way that will hold up legally throughout the world is likely to require a single license that covers the whole work, not just the source code or the text. The Boost license by itself cannot achieve what you want, and you're probably going to need special licensing on the rest of the book as well to make it work around the world, so it makes little sense to not just use one license for the whole thing, even if you have to roll your own to some extent. – Austin Hemmelgarn Jul 12 at 20:25
18

My ideal would be something that requires attribution only in source form, but not in compiled/binary/object form.

The Boost Software License has this very feature baked right into it, no modification needed. It is “very similar to the BSD license and the MIT license” (direct quote), but was designed with these very use-cases in mind:

  • Must require that the license appear with all copies [including redistributions] of the software source code.
  • Must not require that the license appear with executables or other binary uses of the library.

It’s recognized by the Open Source Initiative, and is compatible with the GNU GPL according to the FSF. Like BSD/MIT, it’s reasonably (IMO) brief, consisting only of three paragraphs: a license, a restriction, and a disclaimer:

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:

The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.

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, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

(Emphasis added by me.)

| improve this answer | |
  • +1 from me. That definitely answers the OP's question, and OSI-approved/GPL-compatible goes a long way towards getting it through the sort of corporate doors I refer to. – MadHatter Jul 12 at 7:32
  • This is exactly what I was looking for. Thank you! Although @MadHatter brings up some compelling arguments to go for the more common BSD/MIT license, which I must consider. – Flimzy Jul 12 at 10:16
9

My first thought was that a simple variant of BSD could probably do the job for you, but then I caught myself. It's kind of you, that you don't want to saddle people offering compiled versions of your code with any kind of attribution requirement, but I advise strongly against attempting to embed that in some form of custom licence.

In this talk at FOSDEM (full disclosure: I wrote the article), one of the people responsible for open-source and licensing inside Facebook said that

In the course of his work, he gets many inquiries from Facebook people asking him if they can use a particular piece of technology. His normal workflow is such, he said, that if it takes him more than five seconds to work out if he can use a given piece of technology, he probably won't bother.

If you use some modified form of BSD, then your wishes will be given full expression, and nobody will use your code. If you stick with straight 3BSD, anyone who wants to can reuse your code, because 3BSD is well-understood. Potential users would much rather have your code under simple terms that are well-understood, than under fairly simple terms that are less onerous but less well-understood.

| improve this answer | |
  • 1
    Could you do both, and it licensed under 3BSD and a modified BSD allowing binary distribution? – cat40 Jul 11 at 22:06
  • @cat40 could you? Yes, I don't see why not. Should you? I wouldn't advise it. Someone has to wade through the licence before they can reuse the code, trying to decide if it's 3BSD and X, or 3BSD or X, or X which looks like 3BSD but isn't, or, or... If that someone is my linked speaker, five seconds is not enough time to do anything other than say "it's 3BSD, you can use it", or "it's not plain 3BSD, I'll get back to you in a month or two" - which for all practical purposes is no. – MadHatter Jul 12 at 4:36
  • 3
    This is unfortunately not understood by enough people. This is also the reason why the OSI rejects licenses that are similar to ones that have already been submitted. The idea is to have a small pool of well-understood, well-known licenses, so that all you need to read is the three letters M, I, and T, or B, S, and D, or G, P, and L, instead of having to hire a lawyer and analyze the entire license word-for-word-for-word. – Jörg W Mittag Jul 12 at 14:32
  • @JörgWMittag: I would think that the best way to accommodate ease of decoding with versatility would be to assign letters or numbers to things that may be allowed or forbidden, and then have a license specified as: permissions expressly granted: a, e, f; expressly denied, h,q. If e.g. permission is granted to distribute works in physical form, and nothing would forbid selling bound books, then that would be allowed, but a license might specify e.g. that distribution in tangible forms is generally allowed, with the exception of bound books. – supercat Jul 12 at 20:21

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.