sstate: Fix incorrect return value handling
PATCH 1/1 sstate: Fix incorrect return value handling
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.
meta/classes/sstate.bbclass +2 -1
@@ -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
Quoted 13 lines · Richard Purdie
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_packagewhen heavily using hardlinks.Fix this by placing $? into a variable.
Signed-off-by Richard Purdie <[email protected]>meta/classes/sstate.bbclass +0
-0
meta/classes/sstate.bbclass sstate_create_package () { · line 603
Quoted 6 lines
meta/classes/sstate.bbclass +2
-1@@ -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
Would changing the line to "if [[ $? -ne 0 && $? -ne 1 ]] " be a better fix?
the best,
thank you
Quoted 5 lines
meta/classes/sstate.bbclass +0
-0exit 1 fi set -e
Quoted 9 lines · Ming Liu
Quoted 8 lines · Richard Purdie
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_packagewhen heavily using hardlinks.Fix this by placing $? into a variable.
Signed-off-by Richard Purdie <[email protected]>
Quoted 12 lines
meta/classes/sstate.bbclass sstate_create_package () { · line 603
Quoted 11 lines
meta/classes/sstate.bbclass +2
-1@@ -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 ]; thenWould changing the line to "if [[ $? -ne 0 && $? -ne 1 ]] " be a better fix?
I'm afraid not, "[[" and "&&" in test are bashism.
// Robert
Quoted 9 lines
the best,
thank youQuoted 5 lines
meta/classes/sstate.bbclass +0
-0exit 1 fi set -e
Quoted 25 lines · Robert Yang
Quoted 9 lines · Ming Liu
Quoted 8 lines · Richard Purdie
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_packagewhen heavily using hardlinks.Fix this by placing $? into a variable.
Signed-off-by Richard Purdie <[email protected]>Quoted 12 lines
meta/classes/sstate.bbclass sstate_create_package () { · line 603
Quoted 11 lines
meta/classes/sstate.bbclass +2
-1@@ -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 ]; thenWould changing the line to "if [[ $? -ne 0 && $? -ne 1 ]] " be a better fix?
Quoted 1 line
I'm afraid not, "[[" and "&&" in test are bashism.
Thanks for pointing it out, please ignore my suggestion then, sorry for the noise.
//Ming Liu
Quoted 14 lines
// Robert
Quoted 9 lines
the best,
thank youQuoted 5 lines
meta/classes/sstate.bbclass +0
-0exit 1 fi set -e