diff mbox series

fetch2: don't try to preserve ownership when unpacking files

Message ID 20240913133232.3363082-1-ross.burton@arm.com
State New
Headers show
Series fetch2: don't try to preserve ownership when unpacking files | expand

Commit Message

Ross Burton Sept. 13, 2024, 1:32 p.m. UTC
When copying files as part of the unpack we want to preserve the mode
(so executables are executable) and timestamps (for reproducibility) but
the ownership isn't really relevant: the files should be owned by the
build user and in situations where DL_DIR is shared between multiple
users there's no point asking to replicate ownership which cp will
silently fail to preserve.

Also expand the arguments to be clearer about what options are being
passed.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ross Burton Sept. 13, 2024, 1:35 p.m. UTC | #1
Context: this was a misguided attempt at fixing https://bugzilla.yoctoproject.org/show_bug.cgi?id=15596 which I’ve now concluded can’t have been caused by anything related to preservation of ownership, but as we don’t actually want to preserve ownership in a build this is likely the right thing to do anyway.

Ross

> On 13 Sep 2024, at 14:32, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> 
> When copying files as part of the unpack we want to preserve the mode
> (so executables are executable) and timestamps (for reproducibility) but
> the ownership isn't really relevant: the files should be owned by the
> build user and in situations where DL_DIR is shared between multiple
> users there's no point asking to replicate ownership which cp will
> silently fail to preserve.
> 
> Also expand the arguments to be clearer about what options are being
> passed.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> bitbake/lib/bb/fetch2/__init__.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index ddee4400bbe..753a1c6ca9d 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -1606,7 +1606,7 @@ class FetchMethod(object):
>                     if urlpath.find("/") != -1:
>                         destdir = urlpath.rsplit("/", 1)[0] + '/'
>                         bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
> -                cmd = 'cp -fpPRH "%s" "%s"' % (file, destdir)
> +                cmd = 'cp --force --preserve=mode,timestamps --no-dereference --recursive -H "%s" "%s"' % (file, destdir)
>         else:
>             urldata.unpack_tracer.unpack("archive-extract", unpackdir)
> 
> -- 
> 2.34.1
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#16558): https://lists.openembedded.org/g/bitbake-devel/message/16558
> Mute This Topic: https://lists.openembedded.org/mt/108431570/6875888
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index ddee4400bbe..753a1c6ca9d 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1606,7 +1606,7 @@  class FetchMethod(object):
                     if urlpath.find("/") != -1:
                         destdir = urlpath.rsplit("/", 1)[0] + '/'
                         bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
-                cmd = 'cp -fpPRH "%s" "%s"' % (file, destdir)
+                cmd = 'cp --force --preserve=mode,timestamps --no-dereference --recursive -H "%s" "%s"' % (file, destdir)
         else:
             urldata.unpack_tracer.unpack("archive-extract", unpackdir)