[2.18][PATCH 0/4] Pull request
Passed a-full on autobuilder with 2 AB-INT failures:
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/29/builds/3934
* qemuarm64-ptest failed with #16241 – AB-INT PTEST: util-linux ptest failure: timeout -> retried in https://autobuilder.yoctoproject.org/valkyrie/?#/builders/61/builds/3760
* oe-selftest-fedora failed with #16308 – AB-INT: selftest: xterm: Xt error: Can't open display: :1 -> retried in https://autobuilder.yoctoproject.org/valkyrie/?#/builders/48/builds/3832
The following changes since commit 22021758e66737bcf68dfd2b74adc6a0cb1d42d9:
README: Add "2.18" subject-prefix to git-send-email suggestion (2026-05-19 11:08:15 +0200)
are available in the Git repository at:
https://git.openembedded.org/bitbake-contrib stable/2.18-nut
https://git.openembedded.org/bitbake-contrib/log/?h=stable/2.18-nut
for you to fetch changes up to edd1cd43eee1a1f87dcd1ca356ae4247c41eac8f:
fetch2: Unpack RPMs with --no-absolute-filenames (2026-06-05 12:57:05 +0200)
----------------------------------------------------------------
Anders Heimer (4):
fetch2: validate deb/ipk data member names
fetch2: validate striplevel parameter fetch2/git: quote shallow extra ref arguments
fetch2: Unpack RPMs with --no-absolute-filenames
lib/bb/fetch2/__init__.py | 19 +++++--- lib/bb/fetch2/git.py | 6 ++- lib/bb/tests/fetch.py | 93 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 8 deletions(-)
[bitbake][wrynose][2.18][PATCH 1/4] fetch2: validate deb/ipk data member names
From: Anders Heimer <[email protected]>
The deb/ipk unpack path selects a data archive member from 'ar -t' output and then passes that member name to a shell command. Previously, any member beginning with data.tar. was selected.
Only select known deb/ipk data archive member names when datafile is created. Quote the package path used in the shell command as it can come from the local fetch path.
Add local fetcher regression coverage for quoted package filenames, valid compressed data members, and unsupported or unsafe data member names.
--- lib/bb/fetch2/__init__.py | 10 +++++--- lib/bb/tests/fetch.py | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 3 deletions(-)
lib/bb/fetch2/__init__.py +7 -3
@@ -23,6 +23,7 @@ import collections import subprocess import pickle import errno +import shlex import bb.utils import bb.checksum import bb.process
@@ -1589,16 +1590,19 @@ class FetchMethod(object): elif file.endswith('.deb') or file.endswith('.ipk'): output = subprocess.check_output(['ar', '-t', file], preexec_fn=subprocess_setup) datafile = None + valid_datafiles = ('data.tar', 'data.tar.gz', 'data.tar.xz', + 'data.tar.zst', 'data.tar.bz2', 'data.tar.lzma') if output: for line in output.decode().splitlines(): - if line.startswith('data.tar.') or line == 'data.tar': + if line in valid_datafiles: datafile = line break else: - raise UnpackError("Unable to unpack deb/ipk package - does not contain data.tar* file", urldata.url) + raise UnpackError("Unable to unpack deb/ipk package - does not contain supported data.tar* file", urldata.url) else: raise UnpackError("Unable to unpack deb/ipk package - could not list contents", urldata.url) - cmd = 'ar x %s %s && %s -p -f %s && rm %s' % (file, datafile, tar_cmd, datafile, datafile) + quoted_datafile = shlex.quote(datafile) + cmd = 'ar x %s %s && %s -p -f %s && rm %s' % (shlex.quote(file), quoted_datafile, tar_cmd, quoted_datafile, quoted_datafile) # If 'subdir' param exists, create a dir and use it as destination for unpack cmd if 'subdir' in urldata.parm:
lib/bb/tests/fetch.py +53 -0
71 lines not on this page · raw message
[bitbake][wrynose][2.18][PATCH 4/4] fetch2: Unpack RPMs with --no-absolute-filenames
In reply to Yoann CongalFrom: Anders Heimer <[email protected]>
Use cpio --no-absolute-filenames when unpacking RPM and SRPM archives so absolute paths and parent-directory components in cpio member names are extracted relative to the intended unpack directory.
--- lib/bb/fetch2/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/fetch2/__init__.py +2 -2
@@ -1585,11 +1585,11 @@ class FetchMethod(object): elif file.endswith('.rpm') or file.endswith('.srpm'): if 'extract' in urldata.parm: unpack_file = urldata.parm.get('extract') - cmd = 'rpm2cpio.sh %s | cpio -id %s' % (file, unpack_file) + cmd = 'rpm2cpio.sh %s | cpio --no-absolute-filenames -id %s' % (file, unpack_file) iterate = True iterate_file = unpack_file else: - cmd = 'rpm2cpio.sh %s | cpio -id' % (file) + cmd = 'rpm2cpio.sh %s | cpio --no-absolute-filenames -id' % (file) elif file.endswith('.deb') or file.endswith('.ipk'): output = subprocess.check_output(['ar', '-t', file], preexec_fn=subprocess_setup) datafile = None
[bitbake][wrynose][2.18][PATCH 3/4] fetch2/git: quote shallow extra ref arguments
In reply to Yoann CongalFrom: Anders Heimer <[email protected]>
BB_GIT_SHALLOW_EXTRA_REFS can include wildcard entries. Matching refs advertised by the remote are later passed to git fetch and update-ref while creating shallow tarballs.
Quote the generated command arguments and pass the fetched ref after -- so shell metacharacters and option-like ref names are not interpreted as command syntax or git fetch options.
--- lib/bb/fetch2/git.py | 6 ++++-- lib/bb/tests/fetch.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)
lib/bb/fetch2/git.py +4 -2
@@ -645,9 +645,11 @@ class Git(FetchMethod): for ref in extra_refs: ref_fetch = ref.replace('refs/heads/', '').replace('refs/remotes/origin/', '').replace('refs/tags/', '') - runfetchcmd("%s fetch origin --depth 1 %s" % (ud.basecmd, ref_fetch), d, workdir=dest) + runfetchcmd("%s fetch origin --depth 1 -- %s" % + (ud.basecmd, shlex.quote(ref_fetch)), d, workdir=dest) revision = runfetchcmd("%s rev-parse FETCH_HEAD" % ud.basecmd, d, workdir=dest) - runfetchcmd("%s update-ref %s %s" % (ud.basecmd, ref, revision), d, workdir=dest) + runfetchcmd("%s update-ref %s %s" % + (ud.basecmd, shlex.quote(ref), revision), d, workdir=dest) # The url is local ud.clonedir, set it to upstream one runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=dest)
lib/bb/tests/fetch.py +30 -0
@@ -2215,6 +2215,36 @@ class GitShallowTest(FetcherTest): self.assertRefs(['master', 'origin/master', 'v1.0']) self.assertRevCount(1) + def test_shallow_extra_refs_wildcard_shell_quoted(self): + self.add_empty_file('a') + marker = os.path.join(self.tempdir, 'ref-command-marker') + ref = 'refs/tags/poc;touch${IFS}%s' % marker + self.git(['update-ref', ref, 'HEAD'], cwd=self.srcdir) + + self.d.setVar('BB_GIT_SHALLOW_EXTRA_REFS', 'refs/tags/*') + self.fetch_shallow() + + self.assertFalse(os.path.exists(marker)) + self.assertRefs(['master', 'origin/master', ref]) + + def test_shallow_extra_refs_wildcard_fetch_options(self): + self.add_empty_file('a') + marker = os.path.join(self.tempdir, 'ref-option-marker') + helper = os.path.join(self.tempdir, 'upload-pack-helper') + with open(helper, 'w') as f: + f.write('#!/bin/sh\n') + f.write('touch "%s"\n' % marker) + f.write('exec git-upload-pack "$@"\n') + os.chmod(helper, 0o755) + ref = 'refs/tags/--upload-pack=%s' % helper + self.git(['update-ref', ref, 'HEAD'], cwd=self.srcdir) + + self.d.setVar('BB_GIT_SHALLOW_EXTRA_REFS', 'refs/tags/*') + self.fetch_shallow() + + self.assertFalse(os.path.exists(marker)) + self.assertRefs(['master', 'origin/master', ref]) + def test_shallow_missing_extra_refs(self): self.add_empty_file('a') self.add_empty_file('b')
[bitbake][wrynose][2.18][PATCH 2/4] fetch2: validate striplevel parameter
In reply to Yoann CongalFrom: Anders Heimer <[email protected]>
The striplevel URL parameter is appended to tar_cmd, which is later run through the shell. Validate it as a decimal count before using it in the tar arguments.
--- lib/bb/fetch2/__init__.py | 5 ++++- lib/bb/tests/fetch.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +4 -1
@@ -1542,7 +1542,10 @@ class FetchMethod(object): if unpack: tar_cmd = 'tar --extract --no-same-owner' if 'striplevel' in urldata.parm: - tar_cmd += ' --strip-components=%s' % urldata.parm['striplevel'] + striplevel = urldata.parm['striplevel'] + if not striplevel.isdigit(): + raise UnpackError("Invalid striplevel parameter: %s" % striplevel, urldata.url) + tar_cmd += ' --strip-components=%s' % striplevel if file.endswith('.tar'): cmd = '%s -f %s' % (tar_cmd, file) elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'):
lib/bb/tests/fetch.py +10 -0
@@ -866,6 +866,16 @@ class FetcherLocalTest(FetcherTest): self.assertIn("does not contain supported data.tar* file", str(context.exception)) + def assertInvalidStriplevel(self, value): + with self.assertRaises(bb.fetch2.UnpackError) as context: + self.fetchUnpack(['file://archive.tar;subdir=bar;striplevel=%s' % value]) + self.assertIn("Invalid striplevel parameter", str(context.exception)) + + def test_local_striplevel_rejects_invalid_values(self): + for value in ("abc", "", "-1", "1\n", "1 2"): + with self.subTest(striplevel=repr(value)): + self.assertInvalidStriplevel(value) + def dummyGitTest(self, suffix): # Create dummy local Git repo src_dir = tempfile.mkdtemp(dir=self.tempdir,