TransWikia.com

What license can I use for source code in an (e)book, that does not restrict binary distribution?

Open Source Asked by Flimzy on August 28, 2021

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.

2 Answers

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.)

Correct answer by Mark G. on August 28, 2021

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.

Answered by MadHatter on August 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP