[LTP] nm01: Fix BSD vs POSIX format comparison failure on Power

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Wed May 13 12:37:09 CEST 2026


Hi Wei,

On 2026-05-13, Wei Gao wrote:
> nm01: Fix BSD vs POSIX format comparison failure on Power

> -       ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}' nm_bsd.out \> trimmed_nm_bsd.out
> +       ROD awk '{
> +               if (NF == 2) { val = "0"; type = $1; name = $2; }
> +               else { val = $1; type = $2; name = $3; }
> +               sub(/^0+/, "", val); if (val == "") val = "0";
> +               sub(/^0+/, "", name);
> +               print name type val
> +       }' nm_bsd.out \> nm1.out

Good fix. Replacing gensub() (gawk extension) with sub() is the right
approach here and correctly handles the hex-prefix symbol names on Power.

Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>

Pre-existing issues noticed in the surrounding code (not introduced
by this patch):

- testcases/commands/nm/nm01.sh — Uses intermediate API (. tst_test.sh /
  tst_run) rather than the current style with tst_loader.sh and doc/env
  blocks. Not a blocker for this fix.

---
Note:

Our agent completed the review of the patch.

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list