public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/1] fix xattrs of rootfs when using sstate cache
@ 2023-04-14  2:41 Felix Moessbauer
  2023-04-14  8:22 ` Jan Kiszka
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Felix Moessbauer @ 2023-04-14  2:41 UTC (permalink / raw)
  To: isar-users; +Cc: adriaan.schmidt, Felix Moessbauer

When creating the sstate cache artifact, the extended file attributes
need to be stored in the tar archive as well. Otherwise, capabilities on
files are lost when the artifact from the cache is used.

Note, that for tar versions shipped with debian bullseye and bookworm,
despite of the documentation, both --xattrs and --xattrs-include='*' is
required to store all extended attributes.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/rootfs.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 784793b5..22449d71 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -327,6 +327,8 @@ SSTATETASKS += "do_rootfs_install"
 SSTATECREATEFUNCS += "rootfs_install_sstate_prepare"
 SSTATEPOSTINSTFUNCS += "rootfs_install_sstate_finalize"
 
+SSTATE_TAR_ATTR_FLAGS ?= "--xattrs --xattrs-include='*'"
+
 # the rootfs is owned by root, so we need some sudoing to pack and unpack
 rootfs_install_sstate_prepare() {
     # this runs in SSTATE_BUILDDIR, which will be deleted automatically
@@ -335,7 +337,7 @@ rootfs_install_sstate_prepare() {
     mkdir -p ${WORKDIR}/mnt/rootfs
     sudo mount --bind ${WORKDIR}/rootfs ${WORKDIR}/mnt/rootfs -o ro
     lopts="--one-file-system --exclude=var/cache/apt/archives"
-    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts rootfs
+    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts ${SSTATE_TAR_ATTR_FLAGS} rootfs
     sudo umount ${WORKDIR}/mnt/rootfs
     sudo chown $(id -u):$(id -g) rootfs.tar
 }
@@ -346,7 +348,7 @@ rootfs_install_sstate_finalize() {
     # - after building the rootfs, the tar won't be there, but we also don't need to unpack
     # - after restoring from cache, there will be a tar which we unpack and then delete
     if [ -f rootfs.tar ]; then
-        sudo tar -C ${WORKDIR} -xpf rootfs.tar
+        sudo tar -C ${WORKDIR} -xpf rootfs.tar ${SSTATE_TAR_ATTR_FLAGS}
         rm rootfs.tar
     fi
 }
-- 
2.34.1


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

* Re: [PATCH 1/1] fix xattrs of rootfs when using sstate cache
  2023-04-14  2:41 [PATCH 1/1] fix xattrs of rootfs when using sstate cache Felix Moessbauer
@ 2023-04-14  8:22 ` Jan Kiszka
  2023-04-14  8:33   ` Moessbauer, Felix
  2023-04-19  5:59 ` AW: " Coulon, David
  2023-05-03 14:48 ` Anton Mikanovich
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2023-04-14  8:22 UTC (permalink / raw)
  To: Felix Moessbauer, isar-users; +Cc: adriaan.schmidt

On 14.04.23 04:41, 'Felix Moessbauer' via isar-users wrote:
> When creating the sstate cache artifact, the extended file attributes
> need to be stored in the tar archive as well. Otherwise, capabilities on
> files are lost when the artifact from the cache is used.
> 
> Note, that for tar versions shipped with debian bullseye and bookworm,
> despite of the documentation, both --xattrs and --xattrs-include='*' is
> required to store all extended attributes.

Are we already demanding >= bullseye as build env? Or is buster still
supported?

Jan

> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/classes/rootfs.bbclass | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index 784793b5..22449d71 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -327,6 +327,8 @@ SSTATETASKS += "do_rootfs_install"
>  SSTATECREATEFUNCS += "rootfs_install_sstate_prepare"
>  SSTATEPOSTINSTFUNCS += "rootfs_install_sstate_finalize"
>  
> +SSTATE_TAR_ATTR_FLAGS ?= "--xattrs --xattrs-include='*'"
> +
>  # the rootfs is owned by root, so we need some sudoing to pack and unpack
>  rootfs_install_sstate_prepare() {
>      # this runs in SSTATE_BUILDDIR, which will be deleted automatically
> @@ -335,7 +337,7 @@ rootfs_install_sstate_prepare() {
>      mkdir -p ${WORKDIR}/mnt/rootfs
>      sudo mount --bind ${WORKDIR}/rootfs ${WORKDIR}/mnt/rootfs -o ro
>      lopts="--one-file-system --exclude=var/cache/apt/archives"
> -    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts rootfs
> +    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts ${SSTATE_TAR_ATTR_FLAGS} rootfs
>      sudo umount ${WORKDIR}/mnt/rootfs
>      sudo chown $(id -u):$(id -g) rootfs.tar
>  }
> @@ -346,7 +348,7 @@ rootfs_install_sstate_finalize() {
>      # - after building the rootfs, the tar won't be there, but we also don't need to unpack
>      # - after restoring from cache, there will be a tar which we unpack and then delete
>      if [ -f rootfs.tar ]; then
> -        sudo tar -C ${WORKDIR} -xpf rootfs.tar
> +        sudo tar -C ${WORKDIR} -xpf rootfs.tar ${SSTATE_TAR_ATTR_FLAGS}
>          rm rootfs.tar
>      fi
>  }

-- 
Siemens AG, Technology
Competence Center Embedded Linux


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

* Re: [PATCH 1/1] fix xattrs of rootfs when using sstate cache
  2023-04-14  8:22 ` Jan Kiszka
@ 2023-04-14  8:33   ` Moessbauer, Felix
  0 siblings, 0 replies; 5+ messages in thread
From: Moessbauer, Felix @ 2023-04-14  8:33 UTC (permalink / raw)
  To: isar-users, Kiszka, Jan; +Cc: Schmidt, Adriaan

On Fri, 2023-04-14 at 10:22 +0200, Jan Kiszka wrote:
> On 14.04.23 04:41, 'Felix Moessbauer' via isar-users wrote:
> > When creating the sstate cache artifact, the extended file
> > attributes
> > need to be stored in the tar archive as well. Otherwise,
> > capabilities on
> > files are lost when the artifact from the cache is used.
> > 
> > Note, that for tar versions shipped with debian bullseye and
> > bookworm,
> > despite of the documentation, both --xattrs and --xattrs-
> > include='*' is
> > required to store all extended attributes.
> 
> Are we already demanding >= bullseye as build env? Or is buster still
> supported?

Actually that does not matter, as this pattern will work on any version
(also buster). The point I wanted to highlight here is, that - despite
the documentation saying otherwise - it is not enough to just use --
xattrs. This applies to all tar versions I was able to test (buster,
bullseye, bookworm).

Felix

> 
> Jan
> 
> > 
> > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > ---
> >  meta/classes/rootfs.bbclass | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meta/classes/rootfs.bbclass
> > b/meta/classes/rootfs.bbclass
> > index 784793b5..22449d71 100644
> > --- a/meta/classes/rootfs.bbclass
> > +++ b/meta/classes/rootfs.bbclass
> > @@ -327,6 +327,8 @@ SSTATETASKS += "do_rootfs_install"
> >  SSTATECREATEFUNCS += "rootfs_install_sstate_prepare"
> >  SSTATEPOSTINSTFUNCS += "rootfs_install_sstate_finalize"
> >  
> > +SSTATE_TAR_ATTR_FLAGS ?= "--xattrs --xattrs-include='*'"
> > +
> >  # the rootfs is owned by root, so we need some sudoing to pack and
> > unpack
> >  rootfs_install_sstate_prepare() {
> >      # this runs in SSTATE_BUILDDIR, which will be deleted
> > automatically
> > @@ -335,7 +337,7 @@ rootfs_install_sstate_prepare() {
> >      mkdir -p ${WORKDIR}/mnt/rootfs
> >      sudo mount --bind ${WORKDIR}/rootfs ${WORKDIR}/mnt/rootfs -o
> > ro
> >      lopts="--one-file-system --exclude=var/cache/apt/archives"
> > -    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts rootfs
> > +    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts
> > ${SSTATE_TAR_ATTR_FLAGS} rootfs
> >      sudo umount ${WORKDIR}/mnt/rootfs
> >      sudo chown $(id -u):$(id -g) rootfs.tar
> >  }
> > @@ -346,7 +348,7 @@ rootfs_install_sstate_finalize() {
> >      # - after building the rootfs, the tar won't be there, but we
> > also don't need to unpack
> >      # - after restoring from cache, there will be a tar which we
> > unpack and then delete
> >      if [ -f rootfs.tar ]; then
> > -        sudo tar -C ${WORKDIR} -xpf rootfs.tar
> > +        sudo tar -C ${WORKDIR} -xpf rootfs.tar
> > ${SSTATE_TAR_ATTR_FLAGS}
> >          rm rootfs.tar
> >      fi
> >  }
> 


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

* AW: [PATCH 1/1] fix xattrs of rootfs when using sstate cache
  2023-04-14  2:41 [PATCH 1/1] fix xattrs of rootfs when using sstate cache Felix Moessbauer
  2023-04-14  8:22 ` Jan Kiszka
@ 2023-04-19  5:59 ` Coulon, David
  2023-05-03 14:48 ` Anton Mikanovich
  2 siblings, 0 replies; 5+ messages in thread
From: Coulon, David @ 2023-04-19  5:59 UTC (permalink / raw)
  To: isar-users; +Cc: Schmidt, Adriaan, MOESSBAUER, FELIX JONATHAN

Now the extended file attributes are kept. Thanks Felix.

Tested-by: David Coulon <david.coulon@siemens.com>

-----Ursprüngliche Nachricht-----
Von: Moessbauer, Felix (T CED INW-CN) <felix.moessbauer@siemens.com> 
Gesendet: Freitag, 14. April 2023 04:41
An: isar-users@googlegroups.com
Cc: Schmidt, Adriaan (T CED SES-DE) <adriaan.schmidt@siemens.com>; Moessbauer, Felix (T CED INW-CN) <felix.moessbauer@siemens.com>
Betreff: [PATCH 1/1] fix xattrs of rootfs when using sstate cache

When creating the sstate cache artifact, the extended file attributes need to be stored in the tar archive as well. Otherwise, capabilities on files are lost when the artifact from the cache is used.

Note, that for tar versions shipped with debian bullseye and bookworm, despite of the documentation, both --xattrs and --xattrs-include='*' is required to store all extended attributes.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/rootfs.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass index 784793b5..22449d71 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -327,6 +327,8 @@ SSTATETASKS += "do_rootfs_install"
 SSTATECREATEFUNCS += "rootfs_install_sstate_prepare"
 SSTATEPOSTINSTFUNCS += "rootfs_install_sstate_finalize"
 
+SSTATE_TAR_ATTR_FLAGS ?= "--xattrs --xattrs-include='*'"
+
 # the rootfs is owned by root, so we need some sudoing to pack and unpack
 rootfs_install_sstate_prepare() {
     # this runs in SSTATE_BUILDDIR, which will be deleted automatically @@ -335,7 +337,7 @@ rootfs_install_sstate_prepare() {
     mkdir -p ${WORKDIR}/mnt/rootfs
     sudo mount --bind ${WORKDIR}/rootfs ${WORKDIR}/mnt/rootfs -o ro
     lopts="--one-file-system --exclude=var/cache/apt/archives"
-    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts rootfs
+    sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts 
+ ${SSTATE_TAR_ATTR_FLAGS} rootfs
     sudo umount ${WORKDIR}/mnt/rootfs
     sudo chown $(id -u):$(id -g) rootfs.tar  } @@ -346,7 +348,7 @@ rootfs_install_sstate_finalize() {
     # - after building the rootfs, the tar won't be there, but we also don't need to unpack
     # - after restoring from cache, there will be a tar which we unpack and then delete
     if [ -f rootfs.tar ]; then
-        sudo tar -C ${WORKDIR} -xpf rootfs.tar
+        sudo tar -C ${WORKDIR} -xpf rootfs.tar ${SSTATE_TAR_ATTR_FLAGS}
         rm rootfs.tar
     fi
 }
--
2.34.1


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

* Re: [PATCH 1/1] fix xattrs of rootfs when using sstate cache
  2023-04-14  2:41 [PATCH 1/1] fix xattrs of rootfs when using sstate cache Felix Moessbauer
  2023-04-14  8:22 ` Jan Kiszka
  2023-04-19  5:59 ` AW: " Coulon, David
@ 2023-05-03 14:48 ` Anton Mikanovich
  2 siblings, 0 replies; 5+ messages in thread
From: Anton Mikanovich @ 2023-05-03 14:48 UTC (permalink / raw)
  To: Felix Moessbauer, isar-users; +Cc: adriaan.schmidt

14/04/2023 05:41, 'Felix Moessbauer' via isar-users wrote:
> When creating the sstate cache artifact, the extended file attributes
> need to be stored in the tar archive as well. Otherwise, capabilities on
> files are lost when the artifact from the cache is used.
>
> Note, that for tar versions shipped with debian bullseye and bookworm,
> despite of the documentation, both --xattrs and --xattrs-include='*' is
> required to store all extended attributes.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>

Applied to next, thanks.


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

end of thread, other threads:[~2023-05-03 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14  2:41 [PATCH 1/1] fix xattrs of rootfs when using sstate cache Felix Moessbauer
2023-04-14  8:22 ` Jan Kiszka
2023-04-14  8:33   ` Moessbauer, Felix
2023-04-19  5:59 ` AW: " Coulon, David
2023-05-03 14:48 ` Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox