[LTP] ima_tpm.sh: properly detect failure to verify the IMA measurement list

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Thu Aug 27 05:05:18 CEST 2026


Hi Mimi,

On Wed, 26 Aug 2026, Mimi Zohar wrote:
> ima_tpm.sh: properly detect failure to verify the IMA measurement list

> -	pcr_aggregate="$(cat tmp.txt)"
> +	ret=$?
> +
> +	pcr_aggregate="$(cat tmp.txt | awk '{print $1}')"

The cat here is redundant, awk can read the file directly:

	pcr_aggregate="$(awk '{print $1}' tmp.txt)"

> +	elif [ $ret -eq 0 ]; then
> +		lineno="$(cat tmp.txt | awk '{print $2}')"

Same here:

	lineno="$(awk '{print $2}' tmp.txt)"

> +		tst_res TPASS "aggregate PCR value matched real PCR value (line: $lineno/$total_measurements)"

This line is about 100 columns wide. LTP shell style asks for lines
under 80 characters; perhaps wrap it or shorten the message.

Verdict - Needs revision

---
Note:

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