Skip to contentSkip to conversation

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

PATCH Superseded Pratik Farkase 3 participants 7 messages Jul 20 – Jul 28 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libarchive: ptest: run tests from tmpfs to avoid inode overflow failures

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

---
 .../libarchive/libarchive/run-ptest              | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
meta/recipes-extended/libarchive/libarchive/run-ptest +15 -1
index d6b4c3f934..7f61e1b173 100755
@@ -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"
Signature · 1 line
2.34.1
#1 lore raw
Quoted 10 lines · Pratik Farkase

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.

Quoted 37 lines
---
 .../libarchive/libarchive/run-ptest              | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
meta/recipes-extended/libarchive/libarchive/run-ptest +12 -1
index d6b4c3f934..7f61e1b173 100755
@@ -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

meta/recipes-extended/libarchive/libarchive/run-ptest for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do · line 29

Quoted 4 lines
meta/recipes-extended/libarchive/libarchive/run-ptest +1 -0
@@ -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,

Signature · 1 line
Paul Barker
#2 lore raw

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

________________________________________
From: Paul Barker
Sent: Monday, July 20, 2026 2:39 PM
To: Pratik Farkase; [email protected]
Cc: [email protected]
Subject: Re: [OE-core][PATCH v1] libarchive: ptest: run tests from tmpfs to avoid inode overflow failures

Quoted 10 lines · Pratik Farkase

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.

Quoted 37 lines

---
  .../libarchive/libarchive/run-ptest              | 16 +++++++++++++++-

  1 file changed, 15 insertions(+), 1 deletion(-)
meta/recipes-extended/libarchive/libarchive/run-ptest +0 -0
index d6b4c3f934..7f61e1b173 100755
@@ -1,13 +1,24 @@
   #!/bin/sh

meta/recipes-extended/libarchive/libarchive/run-ptest +2 -0
+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
  
meta/recipes-extended/libarchive/libarchive/run-ptest +9 -0
+# 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

meta/recipes-extended/libarchive/libarchive/run-ptest +0 -0
@@ -15,3 +26,6 @@ for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
Quoted 4 lines

      fi
  done

+cd /

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

Best regards,

Signature · 1 line
Paul Barker

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Paul,

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

Best Regards,
Pratik

________________________________________
From: [email protected] <[email protected]> on behalf of Pratik Farkase via lists.openembedded.org <[email protected]>
Sent: Monday, July 20, 2026 3:05 PM
To: Paul Barker; [email protected]
Cc: [email protected]
Subject: Re: [OE-core][PATCH v1] libarchive: ptest: run tests from tmpfs to avoid inode overflow failures

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

________________________________________
From: Paul Barker
Sent: Monday, July 20, 2026 2:39 PM
To: Pratik Farkase; [email protected]
Cc: [email protected]
Subject: Re: [OE-core][PATCH v1] libarchive: ptest: run tests from tmpfs to avoid inode overflow failures

Quoted 10 lines · Pratik Farkase

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.

Quoted 37 lines

---
  .../libarchive/libarchive/run-ptest | 16 +++++++++++++++-

  1 file changed, 15 insertions(+), 1 deletion(-)
meta/recipes-extended/libarchive/libarchive/run-ptest +0 -0
index d6b4c3f934..7f61e1b173 100755
@@ -1,13 +1,24 @@
   #!/bin/sh

meta/recipes-extended/libarchive/libarchive/run-ptest +2 -0
+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
 
meta/recipes-extended/libarchive/libarchive/run-ptest +9 -0
+# 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

meta/recipes-extended/libarchive/libarchive/run-ptest +1 -1
-    ./$t
+    "$PTEST_DIR"/$t

      if [ $? -eq 0 ]; then
          echo "PASS: $t"
      else

meta/recipes-extended/libarchive/libarchive/run-ptest +0 -0
@@ -15,3 +26,6 @@ for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
Quoted 4 lines

      fi
  done

+cd /

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

Best regards,

--
Paul Barker

#5 lore raw

PATCH v2 1/1 libarchive: ptest: run tests from tmpfs to avoid inode overflow failures

In reply to Pratik Farkase

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

---
Changes in v2:
- Use cd "$PTEST_DIR" instead of cd / after tests complete

---
 .../libarchive/libarchive/run-ptest              | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
meta/recipes-extended/libarchive/libarchive/run-ptest +15 -1
index d6b4c3f934..4af767b29a 100755
@@ -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 "$PTEST_DIR"
+umount "$WORKDIR"
+rmdir "$WORKDIR"
Signature · 1 line
2.34.1
#6 lore raw
Quoted 6 lines · Pratik Farkase

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.

Quoted 7 lines

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 Pratik,

Thanks for the new version. It looks like we have some ptest failures here:

Failed ptests:
{'libarchive': ['libarchive_test',

                'bsdtar_test',
                'bsdcpio_test',
                'bsdcat_test',
                'bsdunzip_test']}

https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/4107
https://autobuilder.yoctoproject.org/valkyrie/#/builders/61/builds/4091
https://autobuilder.yoctoproject.org/valkyrie/#/builders/56/builds/1981

Can you have a look at the issue?

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH v3 1/1 libarchive: ptest: run tests from tmpfs to avoid inode overflow failures

In reply to Pratik Farkase

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.

Set TMPDIR to a tmpfs mount so the test framework creates its working directories there, where inode numbers always start small.

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

---
Changes in v3:
- Use export TMPDIR instead of changing CWD (v2 broke test binary's ability to find reference data files)

Changes in v2:
- Use cd "$PTEST_DIR" instead of cd

---
 .../libarchive/libarchive/run-ptest                | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
meta/recipes-extended/libarchive/libarchive/run-ptest +14 -0
index d6b4c3f934..f5f2ef490c 100755
@@ -1,11 +1,23 @@
 #!/bin/sh
 
+PTEST_DIR=$(cd "$(dirname "$0")" && pwd)
+cd "$PTEST_DIR"
+
 # 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. Set TMPDIR to a
+# tmpfs so test-created files get small inode numbers.
+WORKDIR=$(mktemp -d)
+mount -t tmpfs tmpfs "$WORKDIR"
+export TMPDIR="$WORKDIR"
+
 for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
     ./$t
     if [ $? -eq 0 ]; then
@@ -15,3 +27,5 @@ for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
     fi
 done
 
+umount "$WORKDIR"
+rmdir "$WORKDIR"
Signature · 1 line
2.34.1