All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a'
@ 2020-09-25 12:19 Norman
  2020-09-25 12:26 ` Andrey Zhizhikin
  0 siblings, 1 reply; 6+ messages in thread
From: Norman @ 2020-09-25 12:19 UTC (permalink / raw)
  To: openembedded-core

From cd51db253c1a81e47532f1afacce385e422d9a73 Mon Sep 17 00:00:00 2001
From: Norman Stetter <norman.stetter@garz-fricke.com>
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 <norman.stetter@garz-fricke.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a'
  2020-09-25 12:19 [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a' Norman
@ 2020-09-25 12:26 ` Andrey Zhizhikin
  2020-09-25 12:33   ` Norman
       [not found]   ` <163806DA121A433C.4559@lists.openembedded.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Andrey Zhizhikin @ 2020-09-25 12:26 UTC (permalink / raw)
  To: Norman; +Cc: openembedded-core

On Fri, Sep 25, 2020 at 2:19 PM Norman <norman.stetter@garz-fricke.com> wrote:
>
> From cd51db253c1a81e47532f1afacce385e422d9a73 Mon Sep 17 00:00:00 2001
> From: Norman Stetter <norman.stetter@garz-fricke.com>
> 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.

Isn't the whole intention of using SSTATE_MIRROR to cover exactly
those cases? I do not think that reusing sstate between different
builders via NFS is a proper way to go.

> 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>
> ---
>  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
>
>
> 
>


-- 
Regards,
Andrey.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a'
  2020-09-25 12:26 ` Andrey Zhizhikin
@ 2020-09-25 12:33   ` Norman
       [not found]   ` <163806DA121A433C.4559@lists.openembedded.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Norman @ 2020-09-25 12:33 UTC (permalink / raw)
  To: Andrey Zhizhikin; +Cc: openembedded-core

We do use SSTATE_MIRROR, pointing to a locally mounted drive that gets populated by CI-builds:

SSTATE_MIRRORS = "file://.* file:///var/cache/yocto/sstate-cache/PATH"



> -----Ursprüngliche Nachricht-----
> Von: Andrey Zhizhikin [mailto:andrey.z@gmail.com]
> Gesendet: Friday, September 25, 2020 2:27 PM
> An: Norman Stetter <Norman.Stetter@garz-fricke.com>
> Cc: openembedded-core@lists.openembedded.org
> Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership before
> doing 'touch -a'
> 
> On Fri, Sep 25, 2020 at 2:19 PM Norman <norman.stetter@garz-fricke.com>
> wrote:
> >
> > From cd51db253c1a81e47532f1afacce385e422d9a73 Mon Sep 17 00:00:00
> 2001
> > From: Norman Stetter <norman.stetter@garz-fricke.com>
> > 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.
> 
> Isn't the whole intention of using SSTATE_MIRROR to cover exactly those
> cases? I do not think that reusing sstate between different builders via NFS is
> a proper way to go.
> 
> > 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>
> > ---
> >  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
> >
> >
> > 
> >
> 
> 
> --
> Regards,
> Andrey.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a'
       [not found]   ` <163806DA121A433C.4559@lists.openembedded.org>
@ 2020-09-29  6:55     ` Norman
       [not found]     ` <16392EB84BD69824.17908@lists.openembedded.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Norman @ 2020-09-29  6:55 UTC (permalink / raw)
  To: Andrey Zhizhikin; +Cc: openembedded-core

I went through it again:

The SSTATE_DIR is set to my local build dir inside my home dir. All files here are owned by me.
The SSTATE_MIRRORS is set to a locally mounted shared sstate-cache. Files here are owned by my group, but not my user.

All *.siginfo files in the SSTATE_DIR are symlinks to the respective files in the SSTATE_MIRRORS dir.

The sstate_unpack_package function gets run for every *.siginfo file in SSTATE_DIR. 
If the ${SSTATE_PKG}.siginfo file already exists and is a symlink it's atime is updated (line 850), this affects the destination file of the symlink in SSTATE_MIRRORS, since the --no-dereference switch is not used. The comment in line 849 confirms this is meant to set atime for "local/NFS mirror". But it being a mirror one cannot expect the user running bitbake to be the file owner.

So in my opinion the proposed patch makes sense.


> -----Ursprüngliche Nachricht-----
> Von: openembedded-core@lists.openembedded.org
> [mailto:openembedded-core@lists.openembedded.org] Im Auftrag von
> Norman
> Gesendet: Friday, September 25, 2020 2:33 PM
> An: Andrey Zhizhikin <andrey.z@gmail.com>
> Cc: openembedded-core@lists.openembedded.org
> Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership before
> doing 'touch -a'
> 
> We do use SSTATE_MIRROR, pointing to a locally mounted drive that gets
> populated by CI-builds:
> 
> SSTATE_MIRRORS = "file://.* file:///var/cache/yocto/sstate-cache/PATH"
> 
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Andrey Zhizhikin [mailto:andrey.z@gmail.com]
> > Gesendet: Friday, September 25, 2020 2:27 PM
> > An: Norman Stetter <Norman.Stetter@garz-fricke.com>
> > Cc: openembedded-core@lists.openembedded.org
> > Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership
> > before doing 'touch -a'
> >
> > On Fri, Sep 25, 2020 at 2:19 PM Norman
> > <norman.stetter@garz-fricke.com>
> > wrote:
> > >
> > > From cd51db253c1a81e47532f1afacce385e422d9a73 Mon Sep 17 00:00:00
> > 2001
> > > From: Norman Stetter <norman.stetter@garz-fricke.com>
> > > 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.
> >
> > Isn't the whole intention of using SSTATE_MIRROR to cover exactly
> > those cases? I do not think that reusing sstate between different
> > builders via NFS is a proper way to go.
> >
> > > 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>
> > > ---
> > >  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
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Regards,
> > Andrey.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a'
       [not found]     ` <16392EB84BD69824.17908@lists.openembedded.org>
@ 2020-09-30  7:17       ` Norman
  2020-09-30 10:49         ` Martin Jansa
  0 siblings, 1 reply; 6+ messages in thread
From: Norman @ 2020-09-30  7:17 UTC (permalink / raw)
  To: Andrey Zhizhikin; +Cc: openembedded-core

I would be happy to get some feedback on this patch.

Cheers, 

Norman

> -----Ursprüngliche Nachricht-----
> Von: openembedded-core@lists.openembedded.org
> [mailto:openembedded-core@lists.openembedded.org] Im Auftrag von
> Norman
> Gesendet: Tuesday, September 29, 2020 8:55 AM
> An: Andrey Zhizhikin <andrey.z@gmail.com>
> Cc: openembedded-core@lists.openembedded.org
> Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership before
> doing 'touch -a'
> 
> I went through it again:
> 
> The SSTATE_DIR is set to my local build dir inside my home dir. All files here
> are owned by me.
> The SSTATE_MIRRORS is set to a locally mounted shared sstate-cache. Files
> here are owned by my group, but not my user.
> 
> All *.siginfo files in the SSTATE_DIR are symlinks to the respective files in the
> SSTATE_MIRRORS dir.
> 
> The sstate_unpack_package function gets run for every *.siginfo file in
> SSTATE_DIR.
> If the ${SSTATE_PKG}.siginfo file already exists and is a symlink it's atime is
> updated (line 850), this affects the destination file of the symlink in
> SSTATE_MIRRORS, since the --no-dereference switch is not used. The
> comment in line 849 confirms this is meant to set atime for "local/NFS
> mirror". But it being a mirror one cannot expect the user running bitbake to
> be the file owner.
> 
> So in my opinion the proposed patch makes sense.
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: openembedded-core@lists.openembedded.org
> > [mailto:openembedded-core@lists.openembedded.org] Im Auftrag von
> > Norman
> > Gesendet: Friday, September 25, 2020 2:33 PM
> > An: Andrey Zhizhikin <andrey.z@gmail.com>
> > Cc: openembedded-core@lists.openembedded.org
> > Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership
> > before doing 'touch -a'
> >
> > We do use SSTATE_MIRROR, pointing to a locally mounted drive that gets
> > populated by CI-builds:
> >
> > SSTATE_MIRRORS = "file://.* file:///var/cache/yocto/sstate-cache/PATH"
> >
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Andrey Zhizhikin [mailto:andrey.z@gmail.com]
> > > Gesendet: Friday, September 25, 2020 2:27 PM
> > > An: Norman Stetter <Norman.Stetter@garz-fricke.com>
> > > Cc: openembedded-core@lists.openembedded.org
> > > Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership
> > > before doing 'touch -a'
> > >
> > > On Fri, Sep 25, 2020 at 2:19 PM Norman
> > > <norman.stetter@garz-fricke.com>
> > > wrote:
> > > >
> > > > From cd51db253c1a81e47532f1afacce385e422d9a73 Mon Sep 17
> 00:00:00
> > > 2001
> > > > From: Norman Stetter <norman.stetter@garz-fricke.com>
> > > > 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.
> > >
> > > Isn't the whole intention of using SSTATE_MIRROR to cover exactly
> > > those cases? I do not think that reusing sstate between different
> > > builders via NFS is a proper way to go.
> > >
> > > > 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>
> > > > ---
> > > >  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
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Regards,
> > > Andrey.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a'
  2020-09-30  7:17       ` Norman
@ 2020-09-30 10:49         ` Martin Jansa
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Jansa @ 2020-09-30 10:49 UTC (permalink / raw)
  To: Norman; +Cc: Andrey Zhizhikin, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 5295 bytes --]

It was merged 2 days ago:
https://git.openembedded.org/openembedded-core/commit/?id=f1554e8bd40c640fd58daac18ecf7b458e754109

On Wed, Sep 30, 2020 at 9:17 AM Norman <norman.stetter@garz-fricke.com>
wrote:

> I would be happy to get some feedback on this patch.
>
> Cheers,
>
> Norman
>
> > -----Ursprüngliche Nachricht-----
> > Von: openembedded-core@lists.openembedded.org
> > [mailto:openembedded-core@lists.openembedded.org] Im Auftrag von
> > Norman
> > Gesendet: Tuesday, September 29, 2020 8:55 AM
> > An: Andrey Zhizhikin <andrey.z@gmail.com>
> > Cc: openembedded-core@lists.openembedded.org
> > Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership before
> > doing 'touch -a'
> >
> > I went through it again:
> >
> > The SSTATE_DIR is set to my local build dir inside my home dir. All
> files here
> > are owned by me.
> > The SSTATE_MIRRORS is set to a locally mounted shared sstate-cache. Files
> > here are owned by my group, but not my user.
> >
> > All *.siginfo files in the SSTATE_DIR are symlinks to the respective
> files in the
> > SSTATE_MIRRORS dir.
> >
> > The sstate_unpack_package function gets run for every *.siginfo file in
> > SSTATE_DIR.
> > If the ${SSTATE_PKG}.siginfo file already exists and is a symlink it's
> atime is
> > updated (line 850), this affects the destination file of the symlink in
> > SSTATE_MIRRORS, since the --no-dereference switch is not used. The
> > comment in line 849 confirms this is meant to set atime for "local/NFS
> > mirror". But it being a mirror one cannot expect the user running
> bitbake to
> > be the file owner.
> >
> > So in my opinion the proposed patch makes sense.
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: openembedded-core@lists.openembedded.org
> > > [mailto:openembedded-core@lists.openembedded.org] Im Auftrag von
> > > Norman
> > > Gesendet: Friday, September 25, 2020 2:33 PM
> > > An: Andrey Zhizhikin <andrey.z@gmail.com>
> > > Cc: openembedded-core@lists.openembedded.org
> > > Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership
> > > before doing 'touch -a'
> > >
> > > We do use SSTATE_MIRROR, pointing to a locally mounted drive that gets
> > > populated by CI-builds:
> > >
> > > SSTATE_MIRRORS = "file://.* file:///var/cache/yocto/sstate-cache/PATH"
> > >
> > >
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Andrey Zhizhikin [mailto:andrey.z@gmail.com]
> > > > Gesendet: Friday, September 25, 2020 2:27 PM
> > > > An: Norman Stetter <Norman.Stetter@garz-fricke.com>
> > > > Cc: openembedded-core@lists.openembedded.org
> > > > Betreff: Re: [OE-core][Patch] sstate.bbclass: Check file ownership
> > > > before doing 'touch -a'
> > > >
> > > > On Fri, Sep 25, 2020 at 2:19 PM Norman
> > > > <norman.stetter@garz-fricke.com>
> > > > wrote:
> > > > >
> > > > > From cd51db253c1a81e47532f1afacce385e422d9a73 Mon Sep 17
> > 00:00:00
> > > > 2001
> > > > > From: Norman Stetter <norman.stetter@garz-fricke.com>
> > > > > 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.
> > > >
> > > > Isn't the whole intention of using SSTATE_MIRROR to cover exactly
> > > > those cases? I do not think that reusing sstate between different
> > > > builders via NFS is a proper way to go.
> > > >
> > > > > 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>
> > > > > ---
> > > > >  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
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Regards,
> > > > Andrey.
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 8043 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-30 10:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 12:19 [OE-core][Patch] sstate.bbclass: Check file ownership before doing 'touch -a' Norman
2020-09-25 12:26 ` Andrey Zhizhikin
2020-09-25 12:33   ` Norman
     [not found]   ` <163806DA121A433C.4559@lists.openembedded.org>
2020-09-29  6:55     ` Norman
     [not found]     ` <16392EB84BD69824.17908@lists.openembedded.org>
2020-09-30  7:17       ` Norman
2020-09-30 10:49         ` Martin Jansa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.