Bug 13792 - Which license applies to the code examples in the manual?
Summary: Which license applies to the code examples in the manual?
Alias: None
Product: glibc
Classification: Unclassified
Component: manual (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
: 3178 (view as bug list)
Depends on:
Reported: 2012-03-01 11:17 UTC by David Martin
Modified: 2015-12-19 17:00 UTC (History)
3 users (show)

See Also:
Last reconfirmed:
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description David Martin 2012-03-01 11:17:09 UTC
What is the license for the code examples listed in the manual?

I want to use the rather simple example of subtracting a struct timeval in my project. You can find it here: www.gnu.org/software/libc/manual/html_node/Elapsed-Time.html

What license does apply? The manual itself is under the GNU Free Documentation License. What's the deal with the code examples? The closest in the GNU FDL is the following paragraph at the end:

"If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software."

A clarification would be very much appreciated.
Comment 1 Roland McGrath 2012-03-02 23:52:19 UTC
This came up a few years ago, but I don't think we ever did anything about it.
The whole manual is under the GFDL and thus so are the code samples inside it.

The sizable examples are maintained as plain C source files in the source tree.  So we could easily release those separately under the GPL.

The timeval_subtract function you asked about was not in such a file, but I've just moved it into one.

We can look into making a separate package of these source files, where they would be under the GPL.

Note, however, that the functionality you are looking for is also implemented by the timersub macro in <sys/time.h> (where it is under the LGPL as usual).
Comment 2 Roland McGrath 2012-03-03 00:53:43 UTC
The examples are now individually licensed under the GPL (v2 or later).
You can get them directly from source control using git or a web browser.
I don't think we'll make a separate package of them unless there's real demand.
Comment 3 Joseph Myers 2012-03-03 01:38:23 UTC
*** Bug 3178 has been marked as a duplicate of this bug. ***
Comment 4 David Martin 2012-03-07 09:23:02 UTC
That was quick, I'm impressed. :) At least for me there's no need for a separate package, the source files on their own under the GPL are perfectly fine.
Did not know about the timersub macro though. Thanks for the hint!

Comment 5 David Martin 2012-03-07 09:26:04 UTC
Accidentally had the bug status as UNCONFIRMED under the comment box. Fixed again.
Comment 6 Alex Vong 2015-12-19 17:00:31 UTC
Hi glibc developers,

Can you please also release this piece of example code <https://www.gnu.org/software/libc/manual/html_mono/libc.html#Wordexp-Example> under GPLv2+? I am fixing some code and the example does exactly what I need.

Thank you!