Skip to contentSkip to conversation

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

PATCH Superseded Ross Burton 1 participant 2 messages Sep 13, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +1 -1
index ddee4400bbe..753a1c6ca9d 100644
@@ -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)
 
Signature · 1 line
2.34.1
#1 lore raw

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

Quoted 42 lines · Ross Burton via lists.openembedded.org

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.

---
bitbake/lib/bb/fetch2/__init__.py | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +1 -1
index ddee4400bbe..753a1c6ca9d 100644
@@ -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)
 
Signature · 10 lines
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-