]> code.ossystems Code Review - openembedded-core.git/commitdiff
sstate.bbclass: Check file ownership before doing 'touch -a'
authorNorman Stetter <norman.stetter@garz-fricke.com>
Fri, 25 Sep 2020 11:49:43 +0000 (13:49 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 28 Sep 2020 13:15:45 +0000 (14:15 +0100)
In contrast to 'touching' a file without parameters 'touch -a' can only be
performed by the file owner. In case of a shared sstate-cache served
locally (e.g. over NFS),  where the user running bitbake is not the
owner of sstate-cache files, even if he has write access on group level,
the sstate_unpack_package task will fail.
Checking if the file is owned by the user before attempting to run
'touch -a' on it solves this.

Signed-off-by: Norman Stetter <norman.stetter@garz-fricke.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/sstate.bbclass

index 375196ef21c94c00eb427fa3360f88d0f6d7fef1..66a96a76032fac31c1eaf6e9a20657e4ab3f8b0e 100644 (file)
@@ -847,7 +847,7 @@ python sstate_report_unihash() {
 sstate_unpack_package () {
        tar -xvzf ${SSTATE_PKG}
        # update .siginfo atime on local/NFS mirror
-       [ -w ${SSTATE_PKG}.siginfo ] && [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo
+       [ -O ${SSTATE_PKG}.siginfo ] && [ -w ${SSTATE_PKG}.siginfo ] && [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo
        # Use "! -w ||" to return true for read only files
        [ ! -w ${SSTATE_PKG} ] || touch --no-dereference ${SSTATE_PKG}
        [ ! -w ${SSTATE_PKG}.sig ] || [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig