Skip to contentSkip to conversation

ima-evm-utils: tests: fix finding the "boot_aggregate" value

PATCH In review Mimi Zohar 2 participants 2 messages Jun 24, 2020 Keys-trusted

lore
Share & tools
lore

Mimi Zohar

author maintainer
#0 lore raw

PATCH 1/1 ima-evm-utils: tests: fix finding the "boot_aggregate" value

Searching for the last "boot_aggregate" record in the measurement list could inadvertently match a filename containing the string "boot_aggregate". Prevent this from happening.

---
 tests/boot_aggregate.test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/boot_aggregate.test +1 -1
index 3e961ce5f9aa..fe0c9aa1898e 100755
@@ -121,7 +121,7 @@ check() {
 		if [ "$VERBOSE" != "0" ]; then
 			echo "$hash"
 		fi
-		if grep -e "boot_aggregate$" -e "boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then
+		if grep -e " boot_aggregate$" -e " boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then
 			echo "${GREEN}SUCCESS: boot_aggregate ${hash} found${NORM}"
 			return "$OK"
 		fi
Signature · 1 line
2.7.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Mimi Zohar

Searching for the last "boot_aggregate" record in the measurement list could inadvertently match a filename containing the string "boot_aggregate". Prevent this from happening.

---
 tests/boot_aggregate.test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/boot_aggregate.test +1 -1
index 3e961ce5f9aa..fe0c9aa1898e 100755
@@ -121,7 +121,7 @@ check() {
 		if [ "$VERBOSE" != "0" ]; then
 			echo "$hash"
 		fi
-		if grep -e "boot_aggregate$" -e "boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then
+		if grep -e " boot_aggregate$" -e " boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then
 			echo "${GREEN}SUCCESS: boot_aggregate ${hash} found${NORM}"
 			return "$OK"
 		fi
Signature · 1 line
2.7.5

Considering whitespaces in between file name words are translated to "_" (underscore) in measurement file:

Signature · 2 lines
bmeneg 
PGP Key: http://bmeneg.com/pubkey.txt