Explicitly fail in process_verity if no KEY-VALUE lines are converted.

It seems that verity images are not building correctly with INHERIT +=
"rm_work". Some debugging later it was clear that veritysetup is silently
failing, as the output is piped to process_verity shell function, which masks
the exit code of veritysetup.

Signed-off-by: Zygmunt Krynicki <[email protected]>
---
 classes/dm-verity-img.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/classes/dm-verity-img.bbclass b/classes/dm-verity-img.bbclass
index d809985..60e535b 100644
--- a/classes/dm-verity-img.bbclass
+++ b/classes/dm-verity-img.bbclass
@@ -43,12 +43,19 @@ process_verity() {
     # underscores to create correct shell variable names. For the value part:
     # just trim all white-spaces.
     IFS=":"
+    local N=0
     while read KEY VAL; do
         printf '%s=%s\n' \
             "$(echo "$KEY" | tr '[:lower:]' '[:upper:]' | sed 's/ /_/g')" \
             "$(echo "$VAL" | tr -d ' \t')" >> $ENV
+        N=$(expr N + 1)
     done
 
+    if [ $N -eq 0 ]; then
+        echo "process_verity did not convert any values, something misbehaved, 
probably"
+        exit 1
+    fi
+
     # Add partition size
     echo "DATA_SIZE=$SIZE" >> $ENV
 }
-- 
2.37.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#59538): https://lists.yoctoproject.org/g/yocto/message/59538
Mute This Topic: https://lists.yoctoproject.org/mt/97901992/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to