24

In a response to another question, a poster suggested that under the GPL:

...you need to provide the human readable [code], not a whitespace stripped version...

Readability would seem to me to be subjective and unlikely to be explicitly required by the GPL. Is it?

Armand
  • 6,528

3 Answers3

42

The GPL requires that it be the preferred version for editing. If you normally write in obfuscated code, and make changes directly in it, then that's the source for GPL. If you work on a readable version, and then run it through any sort of obfuscator, the readable version is what the GPL considers the source.

"Readability" is subjective and not defined. It is legal to release really bad, hard to understand, code under the GPL. It is not legal to take the version that you make changes in, remove the whitespace or otherwise make it less readable, and call that the source under the GPL.

6

Taking the GPL v3, in section 1 you have:

The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities.

If the comments and white-space were stripped, as well as function and variable names changed, you would be unable to reasonably modify the work.

In addition:

The Corresponding Source for a work in source code form is that same work.

That same work, not an altered work.

So, to clarify my previous point, the source code has to be unaltered, I'm assuming human writing == human readable. But yes, you could write directly in what could be consider non human readable.

4

The question doesn't include some critical information. If you are the sole author, you can release your own code under whatever license you want (including the GPL) without necessarily following all of its rules. Thus you could ship code in a form that is not preferred for editing it, and not be violating any copyright laws. Whether others could then extend your code in the spirit of it being under a Free Software license is questionable, so few would be likely to try.

However most of the time you will not be the sole author of a work. You will leverage existing code, creating a derived work. Such a work must follow the combined rules of its lineage or you will not have permission to distribute it without violating copyright.

To make this clearer, here's some examples (IANAL):

  • If you use a GPL library in your code, you would not be permitted to ship your own source code only in obfuscated form unless (as David Thornley writes) that actually is the form in which you write and edit it.
  • If you use a LGPL library in your code, you would be permitted to ship your own source code only in obfuscated form. This is because the LGPL only requires you to be able to use the work which uses the library with a newer version of the library.
  • If you extend a LGPL library, this would be like the GPL case, and you would have to ship non-obfuscated code (again unless that's how you actually edit it).
Michael Urman
  • 306
  • 1
  • 4