Bug 1295295

Summary: uglify task fails: An error occurred while processing a template: <template function> has no method 'indexOf'
Product: [Fedora] Fedora Reporter: Dan Callaghan <dcallagh>
Component: nodejs-gruntAssignee: Nobody's working on this, feel free to take it <nobody>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: ctubbsii, piotr1212, tchollingsworth
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nodejs-grunt-1.0.1-2.fc25 nodejs-grunt-1.0.1-1.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-19 06:19:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1323858    
Bug Blocks: 1307666, 1307668, 1307806    

Description Dan Callaghan 2016-01-04 06:38:18 UTC
Description of problem:
nodejs-typeahead.js fails to build in rawhide due to an error in the grunt uglify task.

Version-Release number of selected component (if applicable):
nodejs-grunt-contrib-uglify-0.5.0-3.fc24.noarch

How reproducible:
by rebuilding nodejs-typeahead.js

Steps to Reproduce:
1. Rebuild the nodejs-typeahead.js package

Actual results:
Build fails with this confusing error from grunt:

Running "uglify:bloodhound" (uglify) task
Warning: An error occurred while processing a template (Object function (obj) {
obj || (obj = {});
var __t, __p = '';
with (obj) {
__p +=
((__t = ( buildDir )) == null ? '' : __t) +
'/bloodhound.js';

}
return __p
} has no method 'indexOf'). Use --force to continue.

Aborted due to warnings.

Expected results:
Should build successfully.

Additional info:
typeahead.js has this in its Gruntfile:

    uglify: {
      options: {
        banner: '<%= banner %>',
        enclose: { 'window.jQuery': '$' }
      },  
      bloodhound: {
        options: {
          mangle: false,
          beautify: true,
          compress: false
        },
        src: files.common.concat(files.bloodhound),
        dest: '<%= buildDir %>/bloodhound.js'
      },  
      ...

It looks like the template in question is dest. I don't understand why something is calling indexOf on the unrendered template function. A real stack trace would have been nice...

This is probably caused by the lodash 2->3 transition which happened in rawhide recently. The build works fine on Fedora 23 which still has lodash 2. nodejs-grunt-contrib-uglify was just hacked in rawhide to accept the new lodash version but it probably needed more extensive patching than that.

The current version of nodejs-grunt-contrib-uglify (0.5.0) is a few years old now, the latest version (0.11.0) actually requires lodash 3 so possibly just updating to that version would fix things. That's bug 1108714.

Comment 1 Dan Callaghan 2016-02-14 22:49:10 UTC
Seems like updating grunt-uglify didn't help, there is something else going wrong here...

Comment 2 Jan Kurik 2016-02-24 14:12:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 3 Dan Callaghan 2016-07-11 04:35:46 UTC
This turns out to be a grunt bug, because we are using old grunt (0.4.5) with newer lodash. It has been fixed upstream already in the 1.0.0 release:

https://github.com/gruntjs/grunt/commit/3cc26ba4caf9d673fddf4f4c4c4d3f2446a7d319 lib/grunt/template.js

Comment 4 Piotr Popieluch 2016-08-24 17:30:13 UTC
Seems to build fine now according to koschei, need to check if the grunt update can be backported to f25 and f24.

https://apps.fedoraproject.org/koschei/package/nodejs-typeahead.js

Comment 5 Fedora Update System 2016-09-01 21:50:19 UTC
nodejs-grunt-legacy-log-utils-1.0.0-2.fc25 nodejs-grunt-legacy-log-1.0.0-1.fc25 nodejs-grunt-legacy-util-1.0.0-2.fc25 nodejs-grunt-cli-1.2.0-1.fc25 nodejs-grunt-1.0.1-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a912335c1e

Comment 6 Piotr Popieluch 2016-09-01 21:56:22 UTC
F25 update created, I'm really too short on time at the moment to build it on F24.

Comment 7 Piotr Popieluch 2016-09-01 22:03:53 UTC
Seems there is another broken dep in F25 causing this build to fail.

DEBUG util.py:421:  Error: nothing provides npm(pretty-bytes) < 0.2 needed by nodejs-maxmin-0.2.0-5.fc24.noarch

Comment 8 Fedora Update System 2016-09-02 17:57:52 UTC
nodejs-figures-1.7.0-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a192028863

Comment 9 Fedora Update System 2016-09-02 18:15:12 UTC
nodejs-maxmin-2.1.0-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-d6c3bb68a2

Comment 10 Fedora Update System 2016-09-03 03:54:15 UTC
nodejs-grunt-1.0.1-2.fc25, nodejs-grunt-cli-1.2.0-1.fc25, nodejs-grunt-legacy-log-1.0.0-1.fc25, nodejs-grunt-legacy-log-utils-1.0.0-2.fc25, nodejs-grunt-legacy-util-1.0.0-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-a912335c1e

Comment 11 Fedora Update System 2016-09-04 01:24:16 UTC
nodejs-maxmin-2.1.0-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-d6c3bb68a2

Comment 12 Fedora Update System 2016-09-04 01:24:18 UTC
nodejs-figures-1.7.0-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-a192028863

Comment 13 Fedora Update System 2016-09-09 21:49:53 UTC
nodejs-maxmin-2.1.0-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2016-09-09 21:49:55 UTC
nodejs-figures-1.7.0-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2016-09-09 21:50:08 UTC
nodejs-grunt-1.0.1-2.fc25, nodejs-grunt-cli-1.2.0-1.fc25, nodejs-grunt-legacy-log-1.0.0-1.fc25, nodejs-grunt-legacy-log-utils-1.0.0-2.fc25, nodejs-grunt-legacy-util-1.0.0-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Christopher Tubbs 2016-12-07 00:14:20 UTC
This needs to be fixed in F24. It's blocking js-jquery and js-jquery1 builds on that branch.

Comment 17 Fedora Update System 2016-12-07 20:45:37 UTC
nodejs-figures-1.7.0-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-90ece6d3a9

Comment 18 Fedora Update System 2016-12-08 19:23:33 UTC
nodejs-figures-1.7.0-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-90ece6d3a9

Comment 19 Dan Callaghan 2016-12-08 23:21:02 UTC
Hmm doesn't seem like an update to nodejs-figures has any chance of fixing this bug in grunt...

Was the updated filed with the wrong bz number perhaps?

Comment 20 Piotr Popieluch 2016-12-09 14:59:36 UTC
Figures is needed as dependency for upgrading grunt. Grunt update is needed to fix this issue. Instead of creating a dozen new "depends on" bugs on all needed dependencies, I just add this bug number to the updates.

I'm leaving for a long holiday, resetting "assigned to" to the package maintainer. You might want to request acl if you need this fixed soon.

Comment 21 Fedora Update System 2016-12-09 21:58:41 UTC
nodejs-figures-1.7.0-2.fc24.1 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-c2029d59f3

Comment 22 Fedora Update System 2016-12-11 03:57:40 UTC
nodejs-figures-1.7.0-2.fc24.1 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-c2029d59f3

Comment 23 Fedora Update System 2016-12-11 21:47:46 UTC
nodejs-grunt-legacy-util-1.0.0-1.fc24 nodejs-grunt-legacy-log-utils-1.0.0-1.fc24 nodejs-grunt-legacy-log-1.0.0-1.fc24 nodejs-grunt-cli-1.2.0-1.fc24 nodejs-grunt-init-0.3.2-4.fc24 nodejs-grunt-git-authors-1.2.0-6.fc24 nodejs-grunt-1.0.1-1.fc24 nodejs-grunt-contrib-uglify-0.11.1-4.fc24 nodejs-grunt-contrib-cssmin-0.14.0-4.fc24 nodejs-maxmin-2.1.0-1.fc24 nodejs-gzip-size-3.0.0-1.fc24 nodejs-pretty-bytes-3.0.1-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-66eba7d6c7

Comment 24 Piotr Popieluch 2016-12-11 21:49:56 UTC
buildroot overrides are created for all needed packages, js-jquery should build now.

Comment 25 Fedora Update System 2016-12-13 05:28:11 UTC
nodejs-grunt-1.0.1-1.fc24, nodejs-grunt-cli-1.2.0-1.fc24, nodejs-grunt-contrib-cssmin-0.14.0-4.fc24, nodejs-grunt-contrib-uglify-0.11.1-4.fc24, nodejs-grunt-git-authors-1.2.0-6.fc24, nodejs-grunt-init-0.3.2-4.fc24, nodejs-grunt-legacy-log-1.0.0-1.fc24, nodejs-grunt-legacy-log-utils-1.0.0-1.fc24, nodejs-grunt-legacy-util-1.0.0-1.fc24, nodejs-gzip-size-3.0.0-1.fc24, nodejs-maxmin-2.1.0-1.fc24, nodejs-pretty-bytes-3.0.1-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-66eba7d6c7

Comment 26 Christopher Tubbs 2016-12-20 00:58:06 UTC
+1 Looks like these overrides work. Can't give karma, because bodhi is borked for me right now and page won't load.

But got https://koji.fedoraproject.org/koji/taskinfo?taskID=16976698
and https://koji.fedoraproject.org/koji/taskinfo?taskID=16976720 scratch builds passing.

Comment 27 Fedora Update System 2017-01-19 06:19:45 UTC
nodejs-figures-1.7.0-2.fc24.1 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 28 Fedora Update System 2017-01-19 06:19:48 UTC
nodejs-grunt-1.0.1-1.fc24, nodejs-grunt-cli-1.2.0-1.fc24, nodejs-grunt-contrib-cssmin-0.14.0-4.fc24, nodejs-grunt-contrib-uglify-0.11.1-4.fc24, nodejs-grunt-git-authors-1.2.0-6.fc24, nodejs-grunt-init-0.3.2-4.fc24, nodejs-grunt-legacy-log-1.0.0-1.fc24, nodejs-grunt-legacy-log-utils-1.0.0-1.fc24, nodejs-grunt-legacy-util-1.0.0-1.fc24, nodejs-gzip-size-3.0.0-1.fc24, nodejs-maxmin-2.1.0-1.fc24, nodejs-pretty-bytes-3.0.1-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.