diff mbox series

[v1] libarchive: ptest: run tests from tmpfs to avoid inode overflow failures

Message ID 20260720122619.34696-1-pratik.farkase@est.tech
State Changes Requested
Headers show
Series [v1] libarchive: ptest: run tests from tmpfs to avoid inode overflow failures | expand

Commit Message

Pratik Farkase July 20, 2026, 12:26 p.m. UTC
The bsdcpio_test odc/newc format tests verify archive headers byte-by-byte
including inode and device numbers. On ext4 root filesystems (particularly
qemuarm64 and qemuriscv64) inode numbers can exceed the odc 6-octal-digit
or newc 8-hex-digit field widths, causing intermittent assertion failures
in test_format_newc and test_option_c.

Run all tests from a tmpfs working directory where inode numbers always
start small, avoiding the overflow condition.

[YOCTO #16231] : https://bugzilla.yoctoproject.org/show_bug.cgi?id=16231

Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
 .../libarchive/libarchive/run-ptest              | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Paul Barker July 20, 2026, 12:39 p.m. UTC | #1
On Mon, 2026-07-20 at 14:26 +0200, Pratik Farkase wrote:
> The bsdcpio_test odc/newc format tests verify archive headers byte-by-byte
> including inode and device numbers. On ext4 root filesystems (particularly
> qemuarm64 and qemuriscv64) inode numbers can exceed the odc 6-octal-digit
> or newc 8-hex-digit field widths, causing intermittent assertion failures
> in test_format_newc and test_option_c.
> 
> Run all tests from a tmpfs working directory where inode numbers always
> start small, avoiding the overflow condition.
> 
> [YOCTO #16231] : https://bugzilla.yoctoproject.org/show_bug.cgi?id=16231

Hi,

Has this issue been reported upstream to libarchive? It would be good to
get the test cases fixed so they can handle whatever inode numbers are
allocated.

> 
> Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
> ---
>  .../libarchive/libarchive/run-ptest              | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-extended/libarchive/libarchive/run-ptest b/meta/recipes-extended/libarchive/libarchive/run-ptest
> index d6b4c3f934..7f61e1b173 100755
> --- a/meta/recipes-extended/libarchive/libarchive/run-ptest
> +++ b/meta/recipes-extended/libarchive/libarchive/run-ptest
> @@ -1,13 +1,24 @@
>  #!/bin/sh
>  
> +PTEST_DIR=$(cd "$(dirname "$0")" && pwd)
> +
>  # The fuzz tests run 1000 randomised iterations per archive format and are
>  # meant for dedicated fuzzing infrastructure, not routine ptest runs. They
>  # regularly time out in the time/memory constrained autobuilder QEMU targets
>  # (e.g. test_fuzz_iso9660). Skip them via the upstream escape hatch.
>  export SKIP_TEST_FUZZ=1
>  
> +# The bsdcpio odc/newc format tests verify archive headers byte-by-byte
> +# including inode and device numbers. On ext4 root filesystems inode numbers
> +# can exceed the odc 6-octal-digit (262143) or newc 8-hex-digit (4294967295)
> +# field widths, causing intermittent assertion failures. Run all tests from
> +# a tmpfs where inode numbers start fresh and small.
> +WORKDIR=$(mktemp -d)
> +mount -t tmpfs tmpfs "$WORKDIR"
> +cd "$WORKDIR"
> +
>  for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
> -    ./$t
> +    "$PTEST_DIR"/$t
>      if [ $? -eq 0 ]; then
>          echo "PASS: $t"
>      else
> @@ -15,3 +26,6 @@ for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
>      fi
>  done
>  
> +cd /

It's better to use pushd/popd instead of finishing with `cd /`.

Best regards,
Pratik Farkase July 20, 2026, 1:05 p.m. UTC | #2
Hi Paul,

I tried to report this upstream but issue creation is restricted on the libarchive GitHub repository here: 

https://github.com/libarchive/libarchive/issues

For the cd, since the script uses #!/bin/sh (pushd/popd aren't POSIX), Can i use
cd "$PTEST_DIR"? here. I have sent a v2 with this proposed fix.

Best Regards,
Pratik
Pratik Farkase July 20, 2026, 2 p.m. UTC | #3
Hi Paul,

Correction — I managed to file it upstream after all: https://github.com/libarchive/libarchive/issues/3314

Best Regards,
Pratik
diff mbox series

Patch

diff --git a/meta/recipes-extended/libarchive/libarchive/run-ptest b/meta/recipes-extended/libarchive/libarchive/run-ptest
index d6b4c3f934..7f61e1b173 100755
--- a/meta/recipes-extended/libarchive/libarchive/run-ptest
+++ b/meta/recipes-extended/libarchive/libarchive/run-ptest
@@ -1,13 +1,24 @@ 
 #!/bin/sh
 
+PTEST_DIR=$(cd "$(dirname "$0")" && pwd)
+
 # The fuzz tests run 1000 randomised iterations per archive format and are
 # meant for dedicated fuzzing infrastructure, not routine ptest runs. They
 # regularly time out in the time/memory constrained autobuilder QEMU targets
 # (e.g. test_fuzz_iso9660). Skip them via the upstream escape hatch.
 export SKIP_TEST_FUZZ=1
 
+# The bsdcpio odc/newc format tests verify archive headers byte-by-byte
+# including inode and device numbers. On ext4 root filesystems inode numbers
+# can exceed the odc 6-octal-digit (262143) or newc 8-hex-digit (4294967295)
+# field widths, causing intermittent assertion failures. Run all tests from
+# a tmpfs where inode numbers start fresh and small.
+WORKDIR=$(mktemp -d)
+mount -t tmpfs tmpfs "$WORKDIR"
+cd "$WORKDIR"
+
 for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
-    ./$t
+    "$PTEST_DIR"/$t
     if [ $? -eq 0 ]; then
         echo "PASS: $t"
     else
@@ -15,3 +26,6 @@  for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
     fi
 done
 
+cd /
+umount "$WORKDIR"
+rmdir "$WORKDIR"