diff options
author | Nico Huber <nico.h@gmx.de> | 2024-03-16 01:00:46 +0100 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2024-03-17 20:08:56 +0000 |
commit | 3e4b517265a00be1b679656e1a240bb0d5db9e69 (patch) | |
tree | eb536def299bd0378f69a9c63a55b9089d8f5ad4 /util/cbfstool/linux.h | |
parent | 5c769ab711b8a25150ecf8d612f69d1cae63c2ee (diff) |
genbuild_h: Fix and harden major/minor version parsing
Our major version is suddenly two digits long to represent the year.
This can't be parsed with the current sed scripts. To make sure that
no unparsed data ends up in our major/minor versions, we'll run sed
with `-n' and only print the extracted numbers if anything. Also, to
allow us to use the version numbers in C code, we strip leading zeros
(a leading 0 identifies octal numbers, so for instance 08 for August
is not a valid number).
This can result in empty major/minor version strings, so we move the
default `0' to the final variable expansion.
As a bonus, this makes an explicit check if the numbers can be parsed
unnecessary.
Change-Id: Ie39381a8ef4b971556168b6996efeefe6adf2b14
Reported-by: Christoph Zechner <christophz@vrvis.at>
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81290
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/cbfstool/linux.h')
0 files changed, 0 insertions, 0 deletions