On 14/07/2022 15:39, Anthony PERARD wrote:
> check-endbr.sh works well with gawk, but fails with mawk. The produced
> $ALL file is smaller, it is missing 0x$vma_lo on every line. On mawk,
> int(0x2A) just produce 0, instead of the expected value.
>
> The use of hexadecimal-constant in awk is an optional part of the
> posix spec, and mawk doesn't seems to implemented.
>
> There is a way to convert an hexadecimal to a number be putting it in
> a string, and awk as I understand is supposed to use strtod() to
> convert the string to a number when needed. The expression
> 'int("0x15") + 21' would produce the expected value in `mawk` but now
> `gawk` won't convert the string to a number unless we use the option
> "--non-decimal-data".
>
> So let's convert the hexadecimal number before using it in the awk
> script. The shell as no issue with dealing with hexadecimal-constant
> so we'll simply use the expression "$(( 0x15 ))" to convert the value
> before using it in awk.
>
> Fixes: 4d037425dc ("x86: Build check for embedded endbr64 instructions")
> Reported-by: Luca Fancellu <luca.fance...@arm.com>
> Reported-by: Mathieu Tarral <mathieu.tar...@protonmail.com>
> Signed-off-by: Anthony PERARD <anthony.per...@citrix.com>

Thanks for doing this.  You beat me to it.

On policy first, we have https://gitlab.com/xen-project/xen/-/issues/26
open for tracking this bug.

We should consider having

Resolves xen-project/xen#26

in our list of tags, so Gitlab can properly cross-reference this fix. 
(I wonder if Resolves: works...)

https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically
is the full list of patterns available, but I think we want to keep
Fixes: for it's current meaning.


I also want to wait for the patchew CI run to complete because we've got
several build environments which have been a fertile source of shell
related bugs.

~Andrew

Reply via email to