siggen: Fix dump of non-runtime sigdata
PATCH v2 1/1 siggen: Fix dump of non-runtime sigdata
If the debug code is uncommented in SignatureGeneratorBasic.finalise(), sigtask stamp file are created without runtime data such as 'runtaskdeps' and 'file_checksum_values'. If we then try to run bitbake-dumpsig on one of these files, we will see a traceback as the expected keys are not present in the sigdata dictionary:
Traceback (most recent call last):
File ".../bitbake/bin/bitbake-dumpsig", line 195, in <module>
output = bb.siggen.dump_sigfile(options.sigdatafile1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../bitbake/lib/bb/siggen.py", line 1266, in dump_sigfile
computed_taskhash = calc_taskhash(a_data)
^^^^^^^^^^^^^^^^^^^^^
File ".../bitbake/lib/bb/siggen.py", line 1199, in calc_taskhash
for dep in sigdata['runtaskdeps']:
~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'runtaskdeps'To fix this, do not try to compute a task hash if the required data is not present. We can key off 'runtaskdeps' as this will likely always be needed to calculate a valid task hash.
---
Changes in v2:
- Skip tash hash calculation if 'runtaskdeps' is missing.
- Link to v1: https://lore.kernel.org/r/[email protected]
--- lib/bb/siggen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/bb/siggen.py +5 -2
@@ -1263,7 +1263,10 @@ def dump_sigfile(a): else: output.append("Unable to compute base hash") - computed_taskhash = calc_taskhash(a_data) - output.append("Computed task hash is %s" % computed_taskhash) + if 'runtaskdeps' in a_data: + computed_taskhash = calc_taskhash(a_data) + output.append("Computed task hash is %s" % computed_taskhash) + else: + output.append("Unable to compute task hash") return output
---
base-commit: acf5b02c5aaae1116d33b4e08b2ad7c27d9b94ab
change-id: 20251027-fix-dumpsig-e945637ad89f
Best regards,
Signature · 1 line
Paul Barker