Bug 123665

Summary: jsmin.py license header confusing, mentions non-free license
Product: WebKit Reporter: Emilio Pozuelo Monfort <pochu27>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, cgarcia, changseok, gustavo, joepeck, mrobinson, timothy, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Emilio Pozuelo Monfort 2013-11-02 08:28:18 PDT
[ This is not WebKitGTK+ specific but I found this in that context. feel free to change component as appropriate though ]

Hi,

I just noticed while packaging webkitgtk 2.3.1 that it ships a new file, Source/WebCore/inspector/Scripts/jsmin.py, which has a MIT license with this additional clause:

"The Software shall be used for Good, not Evil."

This is non-free according to Debian, Google, RedHat, Fedora, GNU...:

https://wiki.debian.org/qa.debian.org/jsonevil
http://www.gnu.org/licenses/license-list.html#JSON
http://fedoraproject.org/wiki/Licensing:Main#Bad_Licenses
https://bugzilla.redhat.com/show_bug.cgi?id=455507
http://wonko.com//post/jsmin-isnt-welcome-on-google-code

This file is a copy of Source/WebInspectorUI/Scripts/jsmin.py which isn't shipped in webkitgtk+ tarballs, so we didn't notice before.

Note, this may or may not be the actual license of the file. The file header is:

# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
#
# /* jsmin.c
#    2007-05-22
#
# Copyright (c) 2002 Douglas Crockford  (www.crockford.com)
#
# [ MIT license with non-free clause ]

So the code was rewritten. It's not clear to me whether that license applies to the original file only or if this file is licensed in the same way. If the former, this is not an issue at all, but it should be clarified in the file, preferably clearly stating what the actual license of the file is.
Comment 1 Emilio Pozuelo Monfort 2013-11-02 08:58:18 PDT
Re-reading the header, it really sounds like it's just mentioning the original implementation's license and copyright, but in no way that would influence this implementation's license if it's a complete reimplementation from scratch without reusing any of the non-free code.

Indeed, jsmin 2.0.7 from pypi[1] says:

# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. It was rewritten by Dave St.Germain for speed.
#
# The MIT License (MIT)
# 
# Copyright (c) 2013 Dave St.Germain
# 
# [ here follows the MIT license *without* the good not evil clause ]

[1] https://pypi.python.org/pypi/jsmin

So I suspect our current version of jsmin.py is just mentioning the orignal jsmin.c's license.

Updating our jsmin.py so we have upstream's current header which is less confusing would be nice.
Comment 2 Emilio Pozuelo Monfort 2013-11-02 08:59:39 PDT
Reassigning to webcore. Note we have two copies of this file, one in WebCore/inspector and another one in WebInspectorUI.
Comment 3 Alberto Garcia 2013-11-03 12:57:32 PST
(In reply to comment #1)
> Re-reading the header, it really sounds like it's just mentioning
> the original implementation's license and copyright, but in no way
> that would influence this implementation's license if it's a
> complete reimplementation from scratch without reusing any of the
> non-free code.

Yes, but it's indeed confusing. It seems that Timothy added this file
in r151453, maybe he can clarify?
Comment 4 Timothy Hatcher 2013-11-03 18:23:48 PST
Pulling in the latest upstream version is fine.

Note: WebCore/inspector/Scripts should not be bundled into shipping resources. If it is that is a bug. Nothing in WebCore/inspector ships to customers anymore now that front-end has been removed.
Comment 6 Alberto Garcia 2014-05-07 08:06:32 PDT
Created attachment 230999 [details]
Patch

(In reply to comment #4)
> Pulling in the latest upstream version is fine.

Ok, here it goes. I've done a clean build and everything seems normal.

This version in published under the MIT/Expat license.
Comment 7 Timothy Hatcher 2014-05-07 13:46:51 PDT
You should build with COMBINE_INSPECTOR_RESOURCES defined. That will cause copy-user-interface-resources.pl in WebInspectorUI to call jsmin.py.
Comment 8 Darin Adler 2014-05-07 18:14:13 PDT
Comment on attachment 230999 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=230999&action=review

> Source/JavaScriptCore/ChangeLog:27
> +        (jsmin):
> +        (JavascriptMinify):
> +        (JavascriptMinify.__init__):
> +        (JavascriptMinify.minify):
> +        (JavascriptMinify.minify.write):
> +        (isAlphanum): Deleted.
> +        (UnterminatedComment): Deleted.
> +        (UnterminatedStringLiteral): Deleted.
> +        (UnterminatedRegularExpression): Deleted.
> +        (JavascriptMinify._outA): Deleted.
> +        (JavascriptMinify._outB): Deleted.
> +        (JavascriptMinify._get): Deleted.
> +        (JavascriptMinify._peek): Deleted.
> +        (JavascriptMinify._next): Deleted.
> +        (JavascriptMinify._action): Deleted.
> +        (JavascriptMinify._jsmin): Deleted.

You shouldn’t leave this function list in the change log in a case like this.
Comment 9 Alberto Garcia 2014-05-08 01:57:10 PDT
(In reply to comment #7)
> You should build with COMBINE_INSPECTOR_RESOURCES defined. That will
> cause copy-user-interface-resources.pl in WebInspectorUI to call
> jsmin.py.

copy-user-interface-resources.pl is not used in the GTK+ port, but I
compared all other files minified by jsmin.py and the output from both
versions only differs in a few whitespaces.

(In reply to comment #8)
> You shouldn’t leave this function list in the change log in a case
> like this.

You're right, I'll remove it, thanks!
Comment 10 Alberto Garcia 2014-05-09 00:11:19 PDT
Committed r168523: <http://trac.webkit.org/changeset/168523>