Re: [LTP] [PATCH] ima_kexec.sh: Use %s in printf to prevent evaluating cmdline backslashes

Petr Vorel
2026-04-16T18:40:18Z

Hi Avinesh,

> On systemd-boot systems, the kernel command line contains EFI paths
> with backslashes (e.g., `initrd=\opensuse...\6.19...`).

> Writing this to a file using `printf "$cmdline"` inadvertently evaluates
> these backslashes as escape sequences, corrupting the expected digest
> and causing a false test failure:

> + printf 'initrd=\opensuse-tumbleweed\6.19.11-1-default\initrd-...'
> + cat -v file1
> initrd=\opensuse-tumbleweed^F.19.11-1-default\initrd-...

> ima_kexec 1 TINFO: testing kexec -s -l /boot/Image-6.19.11-1-default --reuse-cmdline
> ima_kexec 1 TFAIL: unable to find a correct measurement

> Fix this by using `printf "%s" "$cmdline"` to ensure the command line
> is treated as literal data.

Thanks a lot, merged!

Kind regards,
Petr