Do patches need to be open source?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Do patches need to be open source?

Post by hgm »

That the GPL is held up in court for a specific case does not prove that everything the GPL claims would be held up.

But imagine the following situation: someone thinks up some brilliant evaluation term, which adds hundreds of Elo to Stockfish. So he writes completely new code using this term, puts it in a DLL, and releases that as a commercial, closed-source binary. No harm can have been done upto there.

Now he takes Stockfish, replaces its Eval() function by a call to his library, and releases the thus modified Stockfish complete with source code under GPL. This now is what the GPL expressly forbids, and my expectation is that this will hold up in court. The added code is obviously incomplete, as it cannot do anything without the proprietry DLL. This modified Stockfish can thus not be legally distributed, without the source code needed to build the DLL.

But now it gets murky. Suppose I modify Stockfish by putting its own evaluation in a DLL, and replace it in the binary by a routine to link to it. The interface could just be passing a pointer to the usual struct of bitboards. Provided I distrbute this with source code, thuis is perfectly legal.

But bitboards are not a Stockfish invention, and all bitboard representations look pretty much the same, and are not copyrightable. What I have in fact done is introduced a new standard interface for communication between search and evaluation, which is in no way specific to Stockfish, but could be used by dozens of other engines. I don't see how any license on Stockfish could now prevent me from distributing a closed-source evaluation function based on my secret term that uses that same standard interface.

What is completely unclear to me is what would happen when I distributed a script that would modify a specific Stockfish version source-wise, by replacing Eval() by a call to my DLL, and leave it to my customers to run that script, ad compile the thus modified Stockfish for private use. The script does not have to contain any Stockfish code, it can insert the code that diverts control to the DLL just at a certain line number. Furthermore, the user does nothing illegal, as he is perfectly allowed to do whatever he wants with Stckfih for private use. So I cannot be accused of aiding and abetting a criminal.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: Do patches need to be open source?

Post by syzygy »

Ras wrote:
syzygy wrote:It _is_ the only mechanism how the GPL can kick in. That is how copyright works.
No, it isn't. Or how else would tools for removing copy protection from programs be illegal? How would the act of cracking itself be illegal? The crack doesn't contain source code from the program to crack, after all.
I suppose you meant to write "code" and not "source code".

If a crack or other program does not contain code from program A, then distributing that crack or other program does not infringe the copyright on program A. Therefore it does not matter how A is licensed.

You are probably thinking of prohibitions on circumventing technical copy protection measures. The programs we are discussing here do not come with technical copy protection measures.
But any "whole work" requirement of the GPL applies only to code to which the GPL applies.
Which is the case in this example because the "whole work" contains a GPL'ed Stockfish.
The point is that if Stockfish plus A is a "whole work", but A does not contain SF code, the GPL on SF does not limit the distribution of A.
That's how the FSF would like it to be, but they did not write copyright law.
But the GPL, which is a valid software licence that has already been tried in court, though not in this specific scenario.
The GPL is not completely invalid, but it doesn't do what the FSF purports it does.
There is no doubt that a proprietary program can dynamically link against a GPL'd library as long as that program as distributed does not include GPL'd code itself.
There is very much doubt because the licence of the library does not allow this, so this would constitute a copyright infringement (usage of library without valid licence). OK, one can link at home of course, but not distribute the result.
as long as that program as distributed does not include GPL'd code itself

The copyright on the library cannot be infringed by distributing a work that has nothing from that library in it.
The FSF will say that the "entire work" includes the proprietary library. But I say no, the "entire work" is at most the modified program and some toy GPL'd library that is just enough to get the program to compile and run.
This is clearly just trying to circumvent the licence because the licence itself says otherwise. If you don't agree, then you don't agree with the licence and therefore don't have ANY licence in that usage scenario. Means, copyright infringement.
No, the license only requires me to license the "entire work" under GPL. That's what I do.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Do patches need to be open source?

Post by Ras »

syzygy wrote:I suppose you meant to write "code" and not "source code".
I didn't really think about it.
You are probably thinking of prohibitions on circumventing technical copy protection measures.
More precisely, to circumvent the licence of the program, yes.
The point is that if Stockfish plus A is a "whole work", but A does not contain SF code, the GPL on SF does not limit the distribution of A.
But it does forbid to distribute the modified Stockfish version. Yeah, of course there is the "free" stub library that just makes that modified SF version compile. It remains to be seen how court proceedings would end.
The copyright on the library cannot be infringed by distributing a work that has nothing from that library in it.
Only that this is not the only point because of the "whole work" clause that explicitely addresses dynamic linkage. Especially US courts have ruled copyright infringement already for reading out certain memory parts (used in cheater bots). Or for uploading custom maps to games because that involved internal structures of the game.

Remember that if one doesn't accept the GPL's definition of a "whole work", then one doesn't accept the licence, and then one doesn't have any licence at all to distribute the modified SF in any way, and that would be copyright infringement. One can't just pick convenient parts of a licence and choose to ignore the inconvenient ones. It's take it or leave it.

Not to mention that actively supporting copyright infringement elsewhere is also illegal.

But I guess we'll have to agree to disagree here. Ultimate certainty could only be brought by higher level court rulings in specific cases. However, deliberately ignoring the explanations that the creators of the licence in question gave would probably in itself be an issue since it proves intention.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: Do patches need to be open source?

Post by syzygy »

Ras wrote:
syzygy wrote:I suppose you meant to write "code" and not "source code".
I didn't really think about it.
You are probably thinking of prohibitions on circumventing technical copy protection measures.
More precisely, to circumvent the licence of the program, yes.
But what (I think) you are thinking of really applies only to circumventing technical copy protection measures.

There is no prohibition on legally circumventing a copyright license (circumventing in the sense of doing something that the drafter of the license had hoped to prevent but did not succeed in preventing).
The copyright on the library cannot be infringed by distributing a work that has nothing from that library in it.
Only that this is not the only point because of the "whole work" clause that explicitely addresses dynamic linkage. Especially US courts have ruled copyright infringement already for reading out certain memory parts (used in cheater bots). Or for uploading custom maps to games because that involved internal structures of the game.
If we are talking about letting a proprietary program link to a GPL'd library, then this is the whole point. Distributing the program is no GPL violation if it contains no GPL'd code.
Remember that if one doesn't accept the GPL's definition of a "whole work", then one doesn't accept the licence, and then one doesn't have any licence at all to distribute the modified SF in any way, and that would be copyright infringement. One can't just pick convenient parts of a licence and choose to ignore the inconvenient ones. It's take it or leave it.
There is no need at all to have a GPL license to distribute code that is not licensed under the GPL.
Not to mention that actively supporting copyright infringement elsewhere is also illegal.
There is nothing illegal about doing or supporting something legal.

I'd rather say the FSF commits a fraud on you by pretending that you are not allowed to distribute non-GPL'd code that just happens to be able to link to a GPL'd library but that contains no GPL'd code whatsoever.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: Do patches need to be open source?

Post by syzygy »

hgm wrote:Now he takes Stockfish, replaces its Eval() function by a call to his library, and releases the thus modified Stockfish complete with source code under GPL. This now is what the GPL expressly forbids, and my expectation is that this will hold up in court. The added code is obviously incomplete, as it cannot do anything without the proprietry DLL. This modified Stockfish can thus not be legally distributed, without the source code needed to build the DLL.
You might be able to get a judge to agree to that, but I would argue as follows. Program code does not have to be "complete" or "functional" to be a "work". An unfinished program is a copyrighted "work" just like an unfinished book.

Suppose I write a story and release it under the GPL. Someone else can take it and modify it. If he uses the modified story as a chapter of a book, he may have to license the book under the GPL if he wants to distribute the book (*). But if he takes out the modified story and distributes just that, there is no need to license the whole book under the GPL. And if he sells the remaining chapters of the book separately under a non-GPL license, there is not much that I (as holder of the copyright on the story) can do against it.

(*) Actually, he can probably argue succesfully that the book just bundles separate works in the form of chapters, each with its own independent copyright.
But now it gets murky. Suppose I modify Stockfish by putting its own evaluation in a DLL, and replace it in the binary by a routine to link to it. The interface could just be passing a pointer to the usual struct of bitboards. Provided I distrbute this with source code, thuis is perfectly legal.

But bitboards are not a Stockfish invention, and all bitboard representations look pretty much the same, and are not copyrightable. What I have in fact done is introduced a new standard interface for communication between search and evaluation, which is in no way specific to Stockfish, but could be used by dozens of other engines. I don't see how any license on Stockfish could now prevent me from distributing a closed-source evaluation function based on my secret term that uses that same standard interface.
I don't see that either.

For example, suppose you haven't invented such a secret term at all. You just modified Stockfish by putting its own evaluation in a DLL, etc. People may wonder what's the use of that, but the GPL does not require you to make modifications that are useful. Clearly, if there is no closed-source secret-term dll, there can be nothing illegal about what you do. So you are free to distribute your modified Stockfish (with source) under the GPL.

Then the next day you invent the secret term and write a DLL. Does that DLL now become part of the "entire work" that you MUST license under the GPL for you to have permission to distribute that same modified Stockfish?

That would mean you are no longer allowed today to distribute what you could lawfully distribute yesterday. And that makes no sense.

And it does not even have to be you that wrote that secret-term DLL. It could be someone else that downloaded your modified Stockfish and created a replacement evaluation DLL.
What is completely unclear to me is what would happen when I distributed a script that would modify a specific Stockfish version source-wise, by replacing Eval() by a call to my DLL, and leave it to my customers to run that script, ad compile the thus modified Stockfish for private use. The script does not have to contain any Stockfish code, it can insert the code that diverts control to the DLL just at a certain line number. Furthermore, the user does nothing illegal, as he is perfectly allowed to do whatever he wants with Stckfih for private use. So I cannot be accused of aiding and abetting a criminal.
I see no GPL violation here.

(But in my view you are free to distribute the modified SF source with the call to the DLL. You may want to avoid distributing the two together, just to be safe, but I am not convinced that even that would be illegal. Both the program and the DLL are independent copyrightable works that just happen to be able to work together.)
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Do patches need to be open source?

Post by Fulvio »

syzygy wrote:But if he takes out the modified story and distributes just that, there is no need to license the whole book under the GPL. And if he sells the remaining chapters of the book separately under a non-GPL license, there is not much that I (as holder of the copyright on the story) can do against it.
It's written in such an assertive tone that I cannot refrain myself from posting a warning for any reader: do not take any internet comment as valid legal advice and think carefully before publishing "The real story of Henry Potter" or filming "Kylo Ren: dark power".
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: Do patches need to be open source?

Post by syzygy »

Fulvio wrote:
syzygy wrote:But if he takes out the modified story and distributes just that, there is no need to license the whole book under the GPL. And if he sells the remaining chapters of the book separately under a non-GPL license, there is not much that I (as holder of the copyright on the story) can do against it.
It's written in such an assertive tone that I cannot refrain myself from posting a warning for any reader: do not take any internet comment as valid legal advice and think carefully before publishing "The real story of Henry Potter" or filming "Kylo Ren: dark power".
The real story of Henry Potter would be a modification of Harry Potter and is not what I was thinking of. But I probably could have been clearer.

My assumption is that my original story is incorporated in some form into a chapter of a book (e.g. as a substory told by a character outside my story). The copyright on all other chapters is held by the other author. On this assumption, it is clear that distributing all chapters together as a single book does not prevent the other author from separately distributing the other chapters under whatever license he likes.

However, if the other author uses creative elements from my story (such as non-trivial characters) in the chapters he writes himself, then those chapters will be derivate works and can only be distributed with my permission. Those chapters will then contain copyrighted material from my story.

So I really meant to state the obvious here: parts of a book that contains no copyrighted material that I created can be distributed without my permission.

Now we look at software code. I create a bunch of source files and release them under the GPL. Someone modifies them, includes library calls and creates a corresponding library. There is still my copyright on the source files that include those library calls, so they have to be GPL'd no matter what. There is no copyright of mine on the source files that make up the library.

And now I will be more cautious in my formulation: in my view there are good reasons to regard each source file as a complete "work" even if they were meant to work together. So, in my view, it is fine to distribute my modified program under the GPL and to distribute the library under a restrictive license.

Of course if the program is compiled and statically linked, it will include code of mine and thus has to be released under the GPL. And that means its full source code also has to be released under the GPL. But if the program is compiled and links dynamically, the "entire work" is just that program and it can be released together with the modified source files but without the library source code.
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Do patches need to be open source?

Post by Fulvio »

hgm wrote: What is completely unclear to me is what would happen when I distributed a script that would modify a specific Stockfish version source-wise, by replacing Eval() by a call to my DLL, and leave it to my customers to run that script, ad compile the thus modified Stockfish for private use. The script does not have to contain any Stockfish code, it can insert the code that diverts control to the DLL just at a certain line number. Furthermore, the user does nothing illegal, as he is perfectly allowed to do whatever he wants with Stckfih for private use. So I cannot be accused of aiding and abetting a criminal.
Derivative works must respect the copyright of the work from which they are derived:
https://www.copyright.gov/circs/circ14.pdf
"Only the owner of copyright in a work has the right to prepare, or to authorize someone else to create, an adaptation of that work."
The GPL is very clear in stating that you are authorized to create a derivative work only if its released under a GPL compatible license:
"To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received."
It doesn't matter the technical way how you realize the derivative work or if you take only a part of the original. That's why, for example, HBO had to pay George R.R. Martin even if a film is a very different thing from a book, and other authors do not have the rights to write sequels to his books.
In the same way a derivative work of GPL copyrighted material, no matter how created, which restricts in any way the "same freedoms that you received" is an unauthorized use and:
"In any case where a copyrighted work is used without
the permission of the copyright owner, copyright protection
will not extend to any part of the work in which such material
has been used unlawfully. The unauthorized adaption of
a work may constitute copyright infringement."
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Do patches need to be open source?

Post by Fulvio »

syzygy wrote:So I really meant to state the obvious here: parts of a book that contains no copyrighted material that I created can be distributed without my permission.
I do not know what led you to this wrong conviction. I can only ask that you take a moment to think about a lot of the common situations: books written by multiple authors, music, films, etc...
It is called joint authorship and it is much more common than collective work:
https://en.wikipedia.org/wiki/Joint_authorship

Code: Select all

And now I will be more cautious in my formulation: in my view there are good reasons to regard each source file as a complete "work" even if they were meant to work together.
Why? The Linux kernel is probably the most used software in the world and it is under the GPL, and it was necessary to make exceptions even to allow the loading of binary drivers.
In Linus own words:
http://linuxmafia.com/faq/Kernel/propri ... dules.html

"That doesn't mean that I would accept just any kind of binary-only module: there are cases where something would be so obviously Linux-specific that it simply wouldn't make sense without the Linux kernel. In those cases, it would also obviously be a derived work, and as such the above excuses don't really apply any more, and it falls under the GPL license."
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: Do patches need to be open source?

Post by syzygy »

Fulvio wrote:It doesn't matter the technical way how you realize the derivative work or if you take only a part of the original. That's why, for example, HBO had to pay George R.R. Martin even if a film is a very different thing from a book, and other authors do not have the rights to write sequels to his books.
In the same way a derivative work of GPL copyrighted material, no matter how created, which restricts in any way the "same freedoms that you received" is an unauthorized use and:
For something to be a derivative work of an original, it has to contain copyrightable material from the original. In case of a movie and a book, that could be the storyline. In case of computer programs, there is basically only code that could be shared. (The functionality is not copyrightable, for example, but here we are not even speaking about copying of functionality.)

The FSF wants you to believe that using another program's API already creates a derivative work. That is just false.

Linus Torvalds also has interesting ideas about what makes a work derivative. His ideas have no basis in copyright law.