[oe-commits] [bitbake] 01/06: codeparser: Switch to sha256 from md5

git at git.openembedded.org git at git.openembedded.org
Thu Jan 3 12:41:37 UTC 2019

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

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

commit 12500dc5a05380589b42ce15091040678d490175
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Mon Dec 17 14:18:59 2018 +0000

    codeparser: Switch to sha256 from md5
    We've reports of hash collision with codeparser. Looking at the way collision
    problems occur with md5 and the way our function templating works, I can believe
    we may run into issues.
    This patch therefore switches to sha256.
    Performance wise, parse time could appear to rise by 4s in 374s
    384329 in 2.966s (md5)
    349743 in 2.340s (sha256)
    34723 in 1.245s (md5)
    since we still have md5 used elsewhere in the code, something we should look at
    next (using sha256 everywhere is around 5.3s in total)
    Unfortunately this does nearly double the size of the codeparser cache file
    due to the hash size change.
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
 lib/bb/codeparser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index 3f8ac1d..ac995a6 100644
--- a/lib/bb/codeparser.py
+++ b/lib/bb/codeparser.py
@@ -33,7 +33,7 @@ from bb.cache import MultiProcessCache
 logger = logging.getLogger('BitBake.CodeParser')
 def bbhash(s):
-    return hashlib.md5(s.encode("utf-8")).hexdigest()
+    return hashlib.sha256(s.encode("utf-8")).hexdigest()
 def check_indent(codestr):
     """If the code is indented, add a top level piece of code to 'remove' the indentation"""
@@ -140,7 +140,7 @@ class CodeParserCache(MultiProcessCache):
     # so that an existing cache gets invalidated. Additionally you'll need
     # to increment __cache_version__ in cache.py in order to ensure that old
     # recipe caches don't trigger "Taskhash mismatch" errors.
     def __init__(self):

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

More information about the Openembedded-commits mailing list