[OE-core] [PATCH] sstate: Fix incorrect return value handling

Richard Purdie richard.purdie at linuxfoundation.org
Fri Sep 12 15:39:16 UTC 2014


The use of [ and && here means $? is reset and the exit 1 error
interception wasn't working, leading to "file changed as we read it"
errors from sstate_create_package when heavily using hardlinks.

Fix this by placing $? into a variable.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 0cb5235..1145a63c 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -599,7 +599,8 @@ sstate_create_package () {
 	if [ "$(ls -A)" ]; then
 		set +e
 		tar -czf $TFILE *
-		if [ $? -ne 0 ] && [ $? -ne 1 ]; then
+		ret=$?
+		if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
 			exit 1
 		fi
 		set -e





More information about the Openembedded-core mailing list