In message: [meta-virtualization][PATCH] image-oci-umoci: preserve file modes 
in rootfs
on 07/01/2025 Florian Wickert via lists.yoctoproject.org wrote:

> cp does not preserve file modes by default.
> This will break sudo (among others) which needs the suid flag to do its
> work.
> 
> This patch adds the --preserve=mode flag to the cp call to fix this.
> 
> Signed-off-by: Florian Wickert <[email protected]>
> ---
>  classes/image-oci-umoci.inc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/classes/image-oci-umoci.inc b/classes/image-oci-umoci.inc
> index c77750fb..bbea2add 100644
> --- a/classes/image-oci-umoci.inc
> +++ b/classes/image-oci-umoci.inc
> @@ -49,8 +49,8 @@ IMAGE_CMD:oci() {
>      fi
>  
>      bbdebug 1 "OCI: populating rootfs"
> -    bbdebug 1 "OCI: cp -r ${IMAGE_ROOTFS}/* $image_bundle_name/rootfs/"
> -    cp -r ${IMAGE_ROOTFS}/* $image_bundle_name/rootfs
> +    bbdebug 1 "OCI: cp -r --preserve=mode ${IMAGE_ROOTFS}/* 
> $image_bundle_name/rootfs/"
> +    cp -r --preserve=mode ${IMAGE_ROOTFS}/* $image_bundle_name/rootfs

Is it just the mode that we are concerned with ? We could
either use install vs cp, or just use -a

I remember thinking that pseudo would fix this up when I
was writing the code, but clearly that is not the case.

Bruce

>  
>      bbdebug 1 "OCI: umoci repack --image $image_name:${OCI_IMAGE_TAG} 
> $image_bundle_name"
>      umoci repack --image $image_name:${OCI_IMAGE_TAG} $image_bundle_name
> -- 
> 2.43.0
> 

> 
> 
> 

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

Reply via email to