coreboot-kgpe-d16/util/genbuild_h
Martin Roth 0110e1abe0 util/genbuild_h: Update printf %d to %s for sh compatability
When printing a date, genbuild_h is printing it as two digits, using
a leading zero if the value is below 10.

The shells like bash, dash, etc don't fully import the numbers 08 and
09 when using the printf conversion specifier %d.  They apparently
interpret the numbers as octal and only import the leading 0, dropping
the 8 or 9. This isn't an issue for 01 to 07, because those are valid
octal numbers, so %d prints them without an issue.  Because 08 and 09
are not valid octal, various shells return different errors:

Example shell returns for 'printf "%d" 08':
 bash: printf: 08: invalid octal number
 dash: printf: 08: not completely converted
 fish: 008: value not completely converted
 yash: printf: `08' is not a valid integer
 sash: printf: 08: not completely converted

To prevent this, just print all of the values as strings.

zsh just seems to ignore the possibility of the value being octal
and prints the value as a single digit 0-9.

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: I97b6aa74d74379f6bdc1f0fceecc8002cc36ca09
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70478
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-12-13 14:34:59 +00:00
..
description.md
genbuild_h.sh util/genbuild_h: Update printf %d to %s for sh compatability 2022-12-13 14:34:59 +00:00