[PATCH] dm-verity-img.bbclass: detect veritysetup failure


Zygmunt Krynicki
 

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@...>
---
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


Zygmunt Krynicki
 

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)
This should have said $(expo $N + 1), I've only tested the failing case before submitting.

ZK