Skip to contentSkip to conversation

[2.8][PATCH 0/4] Patch review

bitbake Yoann Congal 1 participant 5 messages Mar 20

lore
Share & tools
lore
#0 lore raw

Please review this set of changes for 2.8/scarthgap and have comments back by end of day Monday, March 23.

Passed a-full on autobuilder:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/3457

The following changes since commit a0a5ce49f28d886b1dac173842642e69517b44e3:

COW: Fix hardcoded magic numbers and work with python 3.13 (2026-03-16 09:24:26 +0000)

are available in the Git repository at:

https://git.openembedded.org/bitbake-contrib stable/2.8-nut
https://git.openembedded.org/bitbake-contrib/log/?h=stable/2.8-nut

for you to fetch changes up to d3b4c352dd33fca90cd31649eda054b884478739:

fetch2: Fix LFS object checkout in submodules (2026-03-19 00:14:50 +0100)

----------------------------------------------------------------

Philip Lorenz (2):
fetch2: Fix incorrect lfs parametrization for submodules
fetch2: Fix LFS object checkout in submodules

Robert Yang (1):
gitsm: Add clean function

Ross Burton (1):
fetch2: don't try to preserve all attributes when unpacking files

 lib/bb/fetch2/__init__.py |  2 +-
 lib/bb/fetch2/gitsm.py    | 26 +++++++++++++++++++-------
 2 files changed, 20 insertions(+), 8 deletions(-)
#1 lore raw

[bitbake][scarthgap][2.8][PATCH 2/4] gitsm: Add clean function

From: Robert Yang <[email protected]>

Fixed:

$ bitbake utfcpp -cfetch && bitbake utfcpp -ccleanall

The downloads/git2/github.com.nemtrif.ftest won't be cleaned without this fix.

(cherry picked from commit 79f25fc5c1b8d0e08540f4aa07875309f5325f47)
---
 lib/bb/fetch2/gitsm.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
lib/bb/fetch2/gitsm.py +13 -0
index fab4b1164..ba62517f0 100644
@@ -249,6 +249,19 @@ class GitSM(Git):
             # should also be skipped as these files were already smudged in the fetch stage if lfs
             # was enabled.
             runfetchcmd("GIT_LFS_SKIP_SMUDGE=1 %s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)
+    def clean(self, ud, d):
+        def clean_submodule(ud, url, module, modpath, workdir, d):
+            url += ";bareclone=1;nobranch=1"
+            try:
+                newfetch = Fetch([url], d, cache=False)
+                newfetch.clean()
+            except Exception as e:
+                logger.warning('gitsm: submodule clean failed: %s %s' % (type(e).__name__, str(e)))
+
+        self.call_process_submodules(ud, d, True, clean_submodule)
+
+        # Clean top git dir
+        Git.clean(self, ud, d)
 
     def implicit_urldata(self, ud, d):
         import shutil, subprocess, tempfile
#2 lore raw

[bitbake][scarthgap][2.8][PATCH 1/4] fetch2: don't try to preserve all attributes when unpacking files

In reply to Yoann Congal

From: Ross Burton <[email protected]>

When copying files as part of the unpack we currently use cp -p, which is a shortcut for --preserve=mode,ownership,timestamps.

We do want to preserve timestamps, because some fetchers set these explicitly.

We don't care about ownership. If the files are owned by us then they ill remain owned by us, and if they're not then the attempt to change ownership will be silently ignored. In a shared DL_DIR where files have group ownership this group access isn't relevant in the single-user build tree.

We do want to preserve executable bits in the mode, but cp always does this. The difference between --preserve=mode and no --preserve is that the mode isn't preserved exactly (no sticky bits, no suid, umask is applied) but this also isn't a relevant difference in a build tree.

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

The impetus for this is that coreutils 9.4 includes a change in gnulib[1] and will now try to preserve permission-based xattrs if asked to preserve the mode. This can result in cp failing when copying a file from a NFSv4 server with ACLs stored in xattrs to a non-NFS directory where those xattrs cannot be written:

cp: preserving permissions for ‘./jquery-3.7.1.js’: Operation not supported

The error comes from the kernel refusing to write a system.nfs4_acl xattr to a file on ext4.

This situation doesn't appear on all systems with coreutils 9.4, at the time of writing it fails on Ubuntu 24.04 onwards but not Fedora 40. This is because /etc/xattr.conf is used to determine which xattrs describe permissions, and Fedora 40 has removed the NFSv4 attributes[2].

Also, use long-form options to make the cp command clearer.

[1] https://github.com/coreutils/gnulib/commit/eb6a8a4dfb
[2] https://src.fedoraproject.org/rpms/attr/blob/rawhide/f/0003-attr-2.4.48-xattr-conf-nfs4-acls.patch

[ YOCTO #15596 ]

(cherry picked from commit 2f35dac0c821ab231459922ed98e1b2cc599ca9a)

---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +1 -1
index 7b75d5d83..224408de0 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=timestamps --no-dereference --recursive -H "%s" "%s"' % (file, destdir)
         else:
             urldata.unpack_tracer.unpack("archive-extract", unpackdir)
 
#3 lore raw

[bitbake][scarthgap][2.8][PATCH 3/4] fetch2: Fix incorrect lfs parametrization for submodules

In reply to Yoann Congal

From: Philip Lorenz <[email protected]>

The existing code would pass True or False to the git fetcher. As the fetcher expects lfs to be set to 1 this always lead to LFS fetching being disabled.

(cherry picked from commit 5e487a5a096400271ed1e29b0df72903f2304e49)
---
 lib/bb/fetch2/gitsm.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/gitsm.py +1 -1
index ba62517f0..5c9899148 100644
@@ -123,7 +123,7 @@ class GitSM(Git):
             url += ";name=%s" % module
             url += ";subpath=%s" % module
             url += ";nobranch=1"
-            url += ";lfs=%s" % self._need_lfs(ud)
+            url += ";lfs=%s" % ("1" if self._need_lfs(ud) else "0")
             # Note that adding "user=" here to give credentials to the
             # submodule is not supported. Since using SRC_URI to give git://
             # URL a password is not supported, one have to use one of the
#4 lore raw

[bitbake][scarthgap][2.8][PATCH 4/4] fetch2: Fix LFS object checkout in submodules

In reply to Yoann Congal

From: Philip Lorenz <[email protected]>

Skipping smudging prevents the LFS objects from replacing their placeholder files when git submodule update actually checks out the target revision in the submodule. Smudging cannot happen earlier as the clone stored in .git/modules is bare.

This should be fine as long as all LFS objects are available in the download cache (which they are after the other fixes are applied).

(cherry picked from commit d270e33a07c50bb9c08861cf9a6dc51e1fd2d874)
---
 lib/bb/fetch2/gitsm.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
lib/bb/fetch2/gitsm.py +5 -6
index 5c9899148..ef1905333 100644
@@ -243,12 +243,11 @@ class GitSM(Git):
         ret = self.process_submodules(ud, ud.destdir, unpack_submodules, d)
 
         if not ud.bareclone and ret:
-            # All submodules should already be downloaded and configured in the tree.  This simply
-            # sets up the configuration and checks out the files.  The main project config should
-            # remain unmodified, and no download from the internet should occur. As such, lfs smudge
-            # should also be skipped as these files were already smudged in the fetch stage if lfs
-            # was enabled.
-            runfetchcmd("GIT_LFS_SKIP_SMUDGE=1 %s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)
+            cmdprefix = ""
+            # Avoid LFS smudging (replacing the LFS pointers with the actual content) when LFS shouldn't be used but git-lfs is installed.
+            if not self._need_lfs(ud):
+                cmdprefix = "GIT_LFS_SKIP_SMUDGE=1 "
+            runfetchcmd("%s%s submodule update --recursive --no-fetch" % (cmdprefix, ud.basecmd), d, quiet=True, workdir=ud.destdir)
     def clean(self, ud, d):
         def clean_submodule(ud, url, module, modpath, workdir, d):
             url += ";bareclone=1;nobranch=1"