Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The current JS compression in D5 and D6 delete the copyright and license information. We should keep this intact (and move to the top) for not getting a law problem.
Here is an example with http://cssdoc.net/ that is based on javadoc standard that can be used to read this automatically and looks nearly the same like the currently used PHP inline documentation in Drupal.
/**
* @copyright Copyright 2005-2007, Firstname Lastname
* @license CC-A 2.0 (http://creativecommons.org/licenses/by/2.0/)
*/
Comment | File | Size | Author |
---|---|---|---|
#50 | drupal_156124.patch | 289.32 KB | xqus |
#41 | drupal-156124.patch | 2.8 KB | xqus |
#34 | 156124-drupal5.patch | 1.66 KB | xqus |
#32 | 156124-3_1.patch | 2.85 KB | xqus |
#30 | 156124-3_0.patch | 3.14 KB | xqus |
Comments
Comment #1
hass CreditAttribution: hass commentedComment #2
Wim LeersMarking as non-critical.
Comment #3
hass CreditAttribution: hass commentedComment #4
Gábor HojtsyHow would you identify a copyright comment? It is many times not in the @copyright form you use here. Look at the jquery comment for example.
Comment #5
Gábor HojtsyComment #6
hass CreditAttribution: hass commentedThe comments are currently not in this format - yes... but if the copyright information is required by law we are able to keep the information. i see no other way how it can be accomplished in a different way. We need to specify how comments this must look like and then we keep the notice intact (and move to the top). if someone adds normal inline comments in JS this comments will be removed as now. This is the expected behaviour for JS aggregation...
So i prefer to use the example as specification how this comments must looks like, while it is machine readable (what normal inline comments are not).
Comment #7
Gábor HojtsyHow the copyright should look like is not specified by us, but the copyright holder, as in the case of the jquery copyright for example.
Comment #8
Frando CreditAttribution: Frando commentedEither we just include the first phpdoc comment of all files in the aggregated version, or we define some custom marker, like [copyright], [/copyright], which the aggregation function then collects into a new comment at the beginning of the aggregated file. The latter is "more secure", of course, but would require to add these copyright tags to all copyrighted files, e.g. to jquery.js.
Comment #9
hass CreditAttribution: hass commentednobody makes us to keep his comment 100% intact, isn't it? We are made to tell "the copyright owner is..." and "this is licensed under..." nothing more. So as an example for jquery may this ends with:
Original notice:
Aggregateable jquery notices:
The comment should be keept as short as possible by law. name the owner, name the license that's it. don't insert the full license... we'd like to compress code and not keep it as big as it is :-).
Comment #10
Gábor HojtsyWhat we are required to keep and what we are able to modify depends on the exact license text, not some gut feelings. As long as it is not strengthened by a license quote, it is not possible to modify the exact copyright text used by the originating authors.
Comment #11
hass CreditAttribution: hass commentedSorry, i have no clue what you are thinking about... :-) I'm sure we cannot guaranty that this solution will solve all variants today and for future, but nearly "all" and i thought about GPL, LGPL, CC and other variants - will work in this way very well. Other licenses may have issues with Drupal in general or are not allowed together with Drupal and therefore are no real issue. Are you thinking about a 0.01% variant?
I have often seen compressed JS files and all what copyright owners demanded - was one line like Copyright 2005-2007, Firstname Lastname on top. No one have written, we need to include a complete license text!? They understand what the intention is with compressing JS and CSS and nevertheless feel happy that we use their scripts... I think it is a good idea and to keep an additional license string intact, but cannot remember any compressed script with such a line... if someone does not allow alteration/compression of the JS code we can disable compression and keep the original file intact... drupal_add_js() have such a option, isn't it?
How do you like to solve this problem if not in this way?
Comment #12
Gábor HojtsyOK, seems like I was not understandable. The issue comes down to this: does the GPL says that we should keep the original copyright notice as-is, and we should not modify it? Does it say that we can modify it if we want? Does it say nothing about this topic? (Drupal only allows GPL contributions).
Comment #13
keith.smith CreditAttribution: keith.smith commentedFrom Drupal's LICENSE.txt:
www.gnu.org has a FAQ (http://www.gnu.org/copyleft/gpl.html) that -- though I didn't see this specific question -- addresses similar issues. In it, the following notices are recommended:
This sentence, however, probably accurately describes the bare minimum of information necessary on each file:
It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
This "barest minimum" is more or less what seems to be found on jquery.js:
All that said, of course, bear in mind that I am not a lawyer, nor do I play one on tv.
Comment #14
Gábor HojtsyComment #15
Frando CreditAttribution: Frando commentedThis is not only about GPL, though. A custom theme might have a custom copyright notice (as e.g. bluebeach on drupal.org) that one would not want to lose due to compression. So, I think that having some tags in the original css/js files that the aggregator parses out would be the only way to accomplish this. The aggregator should then include the content from between these tags in a comment at the top of the aggregated stylesheet/script file.
Comment #16
Wim LeersHow about this: we list the aggregated JS/CSS files in the aggregated file itself, thereby mentioning that for specifics about licenses, you should look in those files (which are simply the originals).
Comment #17
hass CreditAttribution: hass commentedI'm not a lawer, but it looks like the copyright should be the minimum. If we'd like to provide more info, we add a small copyright notice or a link to the license... but i think it is not required to add such bug text like written in #13. Everybody knows if you reference "GPL" where the GPL is located and we don't need to write all this license text... other licenses are nearly the same. CC for e.g. provide Webpages with their licenses. As Developer you only need to construct a link to "your" CC license and everyone knows "open this link and you can read the appropriate license". Something wrong with this?
Comment #18
xqus CreditAttribution: xqus commentedThe point made by Wim is good, anybody that knows the GPL (and other licenses) that know if that is a good enough solution?
Comment #19
Wim Leers@hass: isn't that what my sugestion does? "linking" to the location of the license?
Comment #20
sun+1 for Wim's idea
Comment #21
hass CreditAttribution: hass commentedyup, sounds a reasonable way
Comment #22
xqus CreditAttribution: xqus commentedHere is a patch implementing what Wim suggested.
Comment #23
sunPlease have a look on Drupal Coding Standards.
In short:
" * ".$GLOBALS['base_url']."/".$file."\n";
to' * '. $GLOBALS['base_url'] .'/'. $file ."\n";
Comment #24
xqus CreditAttribution: xqus commentedOk, here we go again. :)
Comment #25
sunThere are still wrong string concatenations and malformed indents:
btw: String concatenation after file_get_contents($path) seemed to be wrong before and may be fixed herein, too.
Comments should always end with a dot.
Comment #26
xqus CreditAttribution: xqus commentedIn the cases where there are a line break in the string, what is the Drupal way of doing it?
or
Comment #27
sunYou can use double quotes here.
However, if you'd use single quotes, string concatenation should look like
'...following files.' . "\n";
, meaning: insert a space in front of and behind the concatenation character if the preceding and following term is a string.Comment #28
xqus CreditAttribution: xqus commentedSorry for my ignorance.
I have read about string concatenations in the Drupal Coding Standards 4 times now, and I think i got it. The first time i read it, I was rather tired. :)
The Coding Standards says to place a space after the dot if the following term is not a quote. I see "\n" as a quote, and therefor there is no space before it. If this applies to only single-quote quotes, there is a need for two more spaces in the patch.
The rest of the problems, I think I have managed to fix.
Comment #29
sunLooks great - however, it seems you accidently inserted white-space after
After this quick fix, change the status to patch needs review, please.
Comment #30
xqus CreditAttribution: xqus commentedComment #31
sunI'm sorry, it seems we overlooked these accidentally changes:
However, patch applies correctly. Works as described. Changed a CSS file in the queue and reference list was successfully updated.
One more review and this is RTBC.
Comment #32
xqus CreditAttribution: xqus commentedFixed, along with some other small things.
Comment #33
hass CreditAttribution: hass commentedI tried this patch on a D5 with 2 hunks (js compression), what i expected, but it works :-). The size of file will not grow much, what's good. Should we backport this for D5.2, too?
Comment #34
xqus CreditAttribution: xqus commentedHere is a patch for Drupal 5.
Comment #35
moshe weitzman CreditAttribution: moshe weitzman commentedwe distribute drupal with license information. i don't think we are obligated to put a license into every page we serve.
Comment #36
hass CreditAttribution: hass commented@moshe weitzman: Don't forget Themes with CC licenses or other licenses.
Aside, why has someone added the GPL license information to the misc/jquery.js file for D6 if this is not required? Someone from outside cannot see the license of CC after JS or CSS is compressed and may grap the code without notice...
Comment #37
catchneeds a re-roll.
Comment #38
hass CreditAttribution: hass commentedWe shouldn't waste too much time and build this on top of http://drupal.org/node/113607.
Comment #39
xqus CreditAttribution: xqus commentedIs this still a issue, or something that should not be fixed?
Comment #40
hass CreditAttribution: hass commentedStill an issue.
Comment #41
xqus CreditAttribution: xqus commentedReroll against HEAD.
Comment #42
lilou CreditAttribution: lilou commentedIt seems that this bug is no longer active : without this patch, license is stored with optimize mode enabled :
http://localhost/drupal/7.x/sites/default/files/js/ba699c2d833da30af428e... :
Someone can confirm ?
Comment #43
lilou CreditAttribution: lilou commentedMark as postponed until #119441: Compress JS aggregation reopen.
Comment #44
hass CreditAttribution: hass commentedThis is not the case for CSS.
Comment #45
lilou CreditAttribution: lilou commentedSo it's good for me :
Comment #46
hass CreditAttribution: hass commentedThis looks nice.
Comment #47
Anonymous (not verified) CreditAttribution: Anonymous commentedThe last submitted patch failed testing.
Comment #48
Wim LeersComment #49
Damien Tournoud CreditAttribution: Damien Tournoud commentedOnly feature requests and tasks can be assigned to D8 for now, because the Drupal 8 tree is not opened yet.
Comment #50
xqus CreditAttribution: xqus commentedRe-roll to HEAD, just minor changes.
Comment #51
xqus CreditAttribution: xqus commentedComment #53
xqus CreditAttribution: xqus commentedOk, I need some e help here. Any ideas how to get this patch to not fail the color module tests. I guess it's the header in the CSS files that breaks the test.
Comment #54
nod_Comment #55
mgifford#50 is a bad patch. #41 is in the right format but in the latter there must have been some typo.
@xqus - Any idea what the minor changes were?
Comment #56
mgiffordComment #57
Risse CreditAttribution: Risse commentedI'll check this out.
Comment #58
Risse CreditAttribution: Risse commentedComment #59
Wim LeersA patch that fixes this problem lives over at #2258313: Add license information to aggregated assets.