diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-17 14:18:59 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-08 11:16:03 +0000 |
commit | 941c5ddd191993fe18aba5796e397f6244fa80eb (patch) | |
tree | 207144084a0e23cadb2f0f7fe0897258d648e7ee /bitbake/lib/bb/codeparser.py | |
parent | d4036c6fcf20fbae52293343d0a1ee38e5f0c5ba (diff) | |
download | poky-941c5ddd191993fe18aba5796e397f6244fa80eb.tar.gz |
bitbake: 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
Before:
384329 in 2.966s (md5)
After:
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.
(Bitbake rev: 4bed7a97198176503fe8c72d8dd7c36b28fc9dd1)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/codeparser.py')
-rw-r--r-- | bitbake/lib/bb/codeparser.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index 3f8ac1d5f6..ac995a6a1d 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py | |||
@@ -33,7 +33,7 @@ from bb.cache import MultiProcessCache | |||
33 | logger = logging.getLogger('BitBake.CodeParser') | 33 | logger = logging.getLogger('BitBake.CodeParser') |
34 | 34 | ||
35 | def bbhash(s): | 35 | def bbhash(s): |
36 | return hashlib.md5(s.encode("utf-8")).hexdigest() | 36 | return hashlib.sha256(s.encode("utf-8")).hexdigest() |
37 | 37 | ||
38 | def check_indent(codestr): | 38 | def check_indent(codestr): |
39 | """If the code is indented, add a top level piece of code to 'remove' the indentation""" | 39 | """If the code is indented, add a top level piece of code to 'remove' the indentation""" |
@@ -140,7 +140,7 @@ class CodeParserCache(MultiProcessCache): | |||
140 | # so that an existing cache gets invalidated. Additionally you'll need | 140 | # so that an existing cache gets invalidated. Additionally you'll need |
141 | # to increment __cache_version__ in cache.py in order to ensure that old | 141 | # to increment __cache_version__ in cache.py in order to ensure that old |
142 | # recipe caches don't trigger "Taskhash mismatch" errors. | 142 | # recipe caches don't trigger "Taskhash mismatch" errors. |
143 | CACHE_VERSION = 10 | 143 | CACHE_VERSION = 11 |
144 | 144 | ||
145 | def __init__(self): | 145 | def __init__(self): |
146 | MultiProcessCache.__init__(self) | 146 | MultiProcessCache.__init__(self) |