diff mbox series

dm-verity-img.bbclass: detect veritysetup failure

Message ID 20230328102107.347291-1-me@zygoon.pl
State New
Headers show
Series dm-verity-img.bbclass: detect veritysetup failure | expand

Commit Message

Zygmunt Krynicki March 28, 2023, 10:21 a.m. UTC
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 <me@zygoon.pl>
---
 classes/dm-verity-img.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

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
 }