23

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?

3 Answers 3

40

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.

7
  • 1
    very interesting, thanks. Is there a particular part of the license that states this?
    – Armand
    Mar 28, 2011 at 14:01
  • 12
    GPLv2, Terms and Conditions, from clause 3: "The source code for a work means the preferred form of the work for making modifications to it.". Mar 28, 2011 at 14:36
  • 4
    This restriction applies to licensees only. For your own code (no external GPL code drawn in) you can obfuscate as much as you want and still put the GPL sticker on it (to grant the rights to others). nVidia did this with driver code back in the day (1998 or so) May 4, 2011 at 16:28
  • 2
    That said, it's meaningless to "slap a GPL sticker" on a work where you aren't providing usable source code, as in the nVidia example. You may as well have used a proprietary license. Clearly nVidia wanted to be seen as sharing their code without actually sharing their code. Feb 10, 2014 at 0:47
  • 1
    Just out of curiosity. What if you work in a proprietary editor that saves the source in an encrypted form? Theoretically you have the code in the way you work with it, however, nobody else could work with it because it's a proprietary tool nobody has access to.
    – Aidiakapi
    Jul 27, 2015 at 16:41
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).
5
  • 1
    you have to follow all the rules of a license, regardless of who owns copyright. If you decide you want to use your JS library on your own website, and also release it under the GPL, you might want to do that separately. This question is not about the LGPL, although if similar restrictions apply to LGPL as GPL regards code readability then that would be helpful to mention here.
    – Armand
    Mar 28, 2011 at 14:54
  • @Alison: The license conditions apply to the one using (and redistributing, in this case) the works, not to the one originally creating it and licensing to you. Mar 28, 2011 at 19:53
  • 1
    @Alison Disagreed. If you are the sole owner of the work, you can relicense it at will. Therefore you can distribute it under the terms of (magic unspecified license here), and allow others to redistribute it under the terms of the GPL - the GPL only adds rights to allow others to redistribute works derived from yours. Of course this is not a likely scenario, as if you didn't believe in the GPL and were the sole owner, you wouldn't use it. Mar 29, 2011 at 14:57
  • You don't have to ship your own source code that uses an LGPL library, provided that the language allows binaries. You have to ship what would allow a user to change the LGPLed part and rebuild the app (although GPLv2 allows you to prevent the user from installing the changed version). If you do ship source, either from necessity or convenience, it may be obfuscated. May 3, 2011 at 18:14
  • Good point. I'll edit my post to no longer say the LGPL places no requirements on the work which uses it. May 4, 2011 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.