>From cd51db253c1a81e47532f1afacce385e422d9a73 Mon Sep 17 00:00:00 2001
From: Norman Stetter <[email protected]>
Date: Fri, 25 Sep 2020 13:49:43 +0200
Subject: sstate.bbclass: Check file ownership before doing 'touch -a'

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 <[email protected]>
---
 meta/classes/sstate.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 375196ef21..66a96a7603 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -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
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#142782): 
https://lists.openembedded.org/g/openembedded-core/message/142782
Mute This Topic: https://lists.openembedded.org/mt/77078087/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to