Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 25 down vote accepted

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.

share|improve this answer
1  
very interesting, thanks. Is there a particular part of the license that states this? –  Alison Mar 28 '11 at 14:01
8  
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.". –  David Thornley Mar 28 '11 at 14:36
    
+1 Good answer, plus the citation. –  jprete Mar 28 '11 at 15:09
2  
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) –  Patrick Georgi May 4 '11 at 16:28
    
It's worth noting that all restrictions in the GPL apply to licensees only. If the code is all your own work (you haven't re-used anybody else's open source code) then you yourself are not bound to any of the license terms you choose to apply to it when you distribute it to others - those are only for anybody who receives a copy of your work. This is how, for example, companies can dual-license a project as both GPL and a proprietary license. –  thomasrutter Feb 10 at 0:42
show 1 more comment

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).
share|improve this answer
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. –  Alison Mar 28 '11 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. –  Paŭlo Ebermann Mar 28 '11 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. –  Michael Urman Mar 29 '11 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. –  David Thornley May 3 '11 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. –  Michael Urman May 4 '11 at 14:19
show 1 more comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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