Skip to contentSkip to conversation

dm-verity-img.bbclass: detect veritysetup failure

PATCH New Zygmunt Krynicki 1 participant 1 message Mar 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-verity-img.bbclass: detect veritysetup failure

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.

---
 classes/dm-verity-img.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
classes/dm-verity-img.bbclass +7 -0
index d809985..60e535b 100644
@@ -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
 }
Signature · 1 line
2.37.2