[oe-commits] [bitbake] 08/10: fetch2/npm.py: Fix inverted condition to prevent infinite loop

git at git.openembedded.org git at git.openembedded.org
Fri Feb 9 14:22:12 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 545540420112992e53f4a83104af10452df168d0
Author: Böszörményi Zoltán <zboszor at pr.hu>
AuthorDate: Sun Feb 4 09:36:15 2018 +0100

    fetch2/npm.py: Fix inverted condition to prevent infinite loop
    
    At least the cli-color node module has dependencies that have
    cyclic dependency among themselves. npm.py is prepared to deal
    with such a case but the condition is handled only for downloading
    or not a dependency again, but then it goes checking the its
    dependency which causes an infinite loop in _getdependencies().
    Make this function simply return when a dependency is already
    downloaded and only download and check its dependencies when not.
    
    Signed-off-by: Zoltán Böszörményi <zboszor at pr.hu>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/npm.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index b5f148c..730c346 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -195,9 +195,11 @@ class Npm(FetchMethod):
         outputurl = pdata['dist']['tarball']
         data[pkg] = {}
         data[pkg]['tgz'] = os.path.basename(outputurl)
-        if not outputurl in fetchedlist:
-            self._runwget(ud, d, "%s --directory-prefix=%s %s" % (self.basecmd, ud.prefixdir, outputurl), False)
-            fetchedlist.append(outputurl)
+        if outputurl in fetchedlist:
+            return
+
+        self._runwget(ud, d, "%s --directory-prefix=%s %s" % (self.basecmd, ud.prefixdir, outputurl), False)
+        fetchedlist.append(outputurl)
 
         dependencies = pdata.get('dependencies', {})
         optionalDependencies = pdata.get('optionalDependencies', {})

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list