Patchwork sstate.bbclass: ignore the tar failure.

mail settings
Date Sept. 22, 2013, 8:25 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/58475/
State Accepted
Commit fad604b719e00b03e09da5fdb485e72332275b4a
Headers show

Comments - Sept. 22, 2013, 8:25 a.m.
From: Roy Li <>

sstate_package creates hardlink from sysroot to SSTATE_BUILDDIR, and
sstate_create_package stores SSTATE_BUILDDIR into a archive file by
tar, these two task can be run simultaneously for different packages,
and make a hardlink for a file will lead to the change of the links
number of file, and if tar is reading this file, it will fail with exit
code 1, and report "file changed as we read it":

    DEBUG: Executing shell function sstate_create_package
    tar: x86_64-linux/usr/share/aclocal/xorg-macros.m4: file changed as we read it

4b3e353a5[sstate.bbclass: fix parallel building issue] tries to use the
tar parameter --ignore-failed-read to fix, but it does not work, and
tar parameter --warning=no-file-changed can close the warning, but can
not change the exit code. so close shell immediate exit, only fail
if tar returns not 1 and 0.

Exit codes of tar:

Signed-off-by: Roy Li <>
 meta/classes/sstate.bbclass |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)


diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 37ade3f..517c100 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -566,7 +566,12 @@  sstate_create_package () {
 	# Need to handle empty directories
 	if [ "$(ls -A)" ]; then
-		tar --ignore-failed-read -czf $TFILE *
+		set +e
+		tar -czf $TFILE *
+		if [ $? -ne 0 ] && [ $? -ne 1 ]; then
+			exit 1
+		fi
+		set -e
 		tar -cz --file=$TFILE --files-from=/dev/null