public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] sanity: Require tar 1.35 or later on rhel9-alike distros
@ 2026-04-03 11:54 Paul Barker
  2026-04-03 12:06 ` [OE-core] " Quentin Schulz
  2026-04-03 16:47 ` Mathieu Dubois-Briand
  0 siblings, 2 replies; 10+ messages in thread
From: Paul Barker @ 2026-04-03 11:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

tar 1.34 (and possibly earlier versions) is unable to extract tarballs
containing read-only files with xattrs. This was fixed upstream, but
it's unlikely at this point that the fix will be backported to RHEL9
related distros (CentOS Stream 9, AlmaLinux 9, Rocky Linux 9). The issue
affects these distros specifically because they have selinux enabled by
default and this uses xattrs.

The specific failure we've seen is with the /usr/lib/udev/hwdb.bin file
installed by the systemd recipe - this file is chmod 0444. This leads to
the following error, typically during do_image_wic (shortened and split
to make it readable):

    subprocess.CalledProcessError: Command
    'tar --xattrs --xattrs-include='*' -cf - -S -C .../tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/rootfs -p . |
    tar --xattrs --xattrs-include='*' -xf - -C .../tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/tmp-wic/rootfs2'
    returned non-zero exit status 2.

That error message is likely to confuse users, and the fix is not
obvious. So, error out if tar 1.34 or earlier is present on affected
distros and recommend upgrading or using the buildtools tarball.

Signed-off-by: Paul Barker <paul@pbarker.dev>
---
 meta/classes-global/sanity.bbclass | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index b5d905399b73..2e486966a93b 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -551,6 +551,21 @@ def check_tar_version(sanity_data):
     except subprocess.CalledProcessError as e:
         return "Unable to execute tar --help, exit code %d\n%s\n" % (e.returncode, e.output)
 
+    try:
+        distro = oe.lsb.distro_identifier()
+    except Exception:
+        distro = None
+
+    if distro:
+        rhel9_alike_prefixes = ("rhel-9", "centos-9", "rocky-9", "almalinux-9")
+        rhel9_tar_minimum_version = "1.35"
+        for prefix in rhel9_alike_prefixes:
+            if distro.startswith(prefix) and bb.utils.vercmp_string_op(version, rhel9_tar_minimum_version, "<"):
+                return ("Your version of tar is older than %s and crashes when extracting read-only files with xattrs. "
+                        "Your distro is %s which triggers this bug due to the presence of selinux attributes. "
+                        "Please install a newer version of tar (you could use the project's buildtools-tarball from "
+                        "our last release or use scripts/install-buildtools).\n" % (rhel9_tar_minimum_version, distro))
+
     return None
 
 # We use git parameters and functionality only found in 1.7.8 or later

---
base-commit: e954a94b5b528b2430e8da331107d7d58287f89b
change-id: 20260403-rhel9-tar-8052bfa93d23

Best regards,
--  
Paul Barker



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-04-05 14:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 11:54 [PATCH] sanity: Require tar 1.35 or later on rhel9-alike distros Paul Barker
2026-04-03 12:06 ` [OE-core] " Quentin Schulz
2026-04-03 12:30   ` Paul Barker
2026-04-03 12:56     ` Quentin Schulz
2026-04-03 13:06       ` Paul Barker
2026-04-03 13:27         ` Quentin Schulz
2026-04-03 16:47 ` Mathieu Dubois-Briand
2026-04-03 17:07   ` Yoann Congal
2026-04-04  5:55     ` Mathieu Dubois-Briand
2026-04-05 14:15       ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox