diff mbox series

libarchive: Fix intermittent bsdcpio test_option_c ptest failure

Message ID 20261201204307.161117-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series libarchive: Fix intermittent bsdcpio test_option_c ptest failure | expand

Commit Message

Khem Raj Dec. 1, 2026, 8:43 p.m. UTC
test_option_c samples time(NULL) after creating its files and then
asserts that their archived mtimes are not later than that. On
qemuarm64 the file, symlink and directory can carry an mtime in the
next second, so bsdcpio_test failed with three failed assertions in
test_option_c. Backport the upstream fix that allows one second of
skew, as test_format_newc already does.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...e-second-of-mtime-skew-in-the-odc-te.patch | 48 +++++++++++++++++++
 .../libarchive/libarchive_3.8.11.bb           |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta/recipes-extended/libarchive/libarchive/0006-bsdcpio-allow-one-second-of-mtime-skew-in-the-odc-te.patch
diff mbox series

Patch

diff --git a/meta/recipes-extended/libarchive/libarchive/0006-bsdcpio-allow-one-second-of-mtime-skew-in-the-odc-te.patch b/meta/recipes-extended/libarchive/libarchive/0006-bsdcpio-allow-one-second-of-mtime-skew-in-the-odc-te.patch
new file mode 100644
index 0000000000..923e0e9ea2
--- /dev/null
+++ b/meta/recipes-extended/libarchive/libarchive/0006-bsdcpio-allow-one-second-of-mtime-skew-in-the-odc-te.patch
@@ -0,0 +1,48 @@ 
+From dd64c2f9d2421bca6061ade4f7887245f27655ab Mon Sep 17 00:00:00 2001
+From: azhovan <azhovan@outlook.com>
+Date: Thu, 19 Nov 2026 17:21:26 +0100
+Subject: [PATCH] bsdcpio: allow one second of mtime skew in the odc test
+
+On Yocto qemuarm64, the file, symlink and directory in test_option_c
+can have mtimes later than the sampled time(NULL). The odc archive
+contains their on-disk mtimes, but all three upper-bound checks fail.
+
+Use the same one-second upper bound as test_format_newc.
+
+Upstream-Status: Backport [https://github.com/libarchive/libarchive/commit/dd64c2f9d2421bca6061ade4f7887245f27655ab]
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+ cpio/test/test_option_c.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/cpio/test/test_option_c.c b/cpio/test/test_option_c.c
+index 2414a4658b..537fa5cc58 100644
+--- a/cpio/test/test_option_c.c
++++ b/cpio/test/test_option_c.c
+@@ -120,7 +120,7 @@ DEFINE_TEST(test_option_c)
+ 	    (unsigned int)dev);
+ 	assertEqualMem(e + 42, "000000", 6); /* rdev */
+ 	t = from_octal(e + 48, 11); /* mtime */
+-	assert(t <= now); /* File wasn't created in future. */
++	assert(t <= now + 1);
+ 	assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ 	assertEqualMem(e + 59, "000005", 6); /* Name size */
+ 	assertEqualMem(e + 65, "00000000012", 11); /* File size */
+@@ -146,7 +146,7 @@ DEFINE_TEST(test_option_c)
+ 		    from_octal(e + 6, 6));
+ 		assertEqualMem(e + 42, "000000", 6); /* rdev */
+ 		t = from_octal(e + 48, 11); /* mtime */
+-		assert(t <= now); /* File wasn't created in future. */
++		assert(t <= now + 1);
+ 		assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ 		assertEqualMem(e + 59, "000010", 6); /* Name size */
+ 		assertEqualMem(e + 65, "00000000004", 11); /* File size */
+@@ -182,7 +182,7 @@ DEFINE_TEST(test_option_c)
+ #endif
+ 
+ 	t = from_octal(e + 48, 11); /* mtime */
+-	assert(t <= now); /* File wasn't created in future. */
++	assert(t <= now + 1);
+ 	assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ 	assertEqualMem(e + 59, "000004", 6); /* Name size */
+ 	assertEqualMem(e + 65, "00000000000", 11); /* File size */
diff --git a/meta/recipes-extended/libarchive/libarchive_3.8.11.bb b/meta/recipes-extended/libarchive/libarchive_3.8.11.bb
index 8300164df1..59863eb679 100644
--- a/meta/recipes-extended/libarchive/libarchive_3.8.11.bb
+++ b/meta/recipes-extended/libarchive/libarchive_3.8.11.bb
@@ -34,6 +34,7 @@  SRC_URI = "https://libarchive.org/downloads/libarchive-${PV}.tar.gz \
            file://0003-archive_read-register_bidder-Allow-ARCHIVE_STATE_HEADER.patch \
            file://0004-Convert-RPM-reader-into-a-proper-format.patch \
            file://0005-Disable-RPM-filter-auto-bidding.patch \
+           file://0006-bsdcpio-allow-one-second-of-mtime-skew-in-the-odc-te.patch \
            "
 UPSTREAM_CHECK_URI = "https://www.libarchive.org/"