Bruno Haible via GNU coreutils General Discussion <[email protected]>
writes:

> Today's CI shows a test failure on NetBSD 10.0, that was not present last 
> week:
>
> FAIL: tests/dd/bytes
> ====================
>
> ulimit: error setting limit (Invalid argument)
> dd: invalid number: 'B'
> dd: invalid number: 'B1'
> dd: invalid number: 'Bx1'
> dd: invalid number: 'KBB'
> dd: invalid number: 'BB'
> dd: invalid number: 'KBb'
> dd: invalid number: 'KBx'
> dd: invalid number: 'x1'
> dd: invalid number: '1x'
> dd: invalid number: '1xx1'
> FAIL tests/dd/bytes.sh (exit status: 1)

I tried a few times on a cfarm machine and couldn't reproduce this one.

But, I noticed when running '(ulimit -S -s 256)' many times, it tends to
fail repeatedly and then succeed repeatedly or vice versa.

With that in mind, looking at this part of the test:

    # Check that long multiplier chains don't exhaust a restricted stack.
    if (ulimit -S -s 256 && dd if=/dev/null count=1) 2>/dev/null; then
      long_multiplier=$(yes 1x | head -n 10000 | tr -d '\n')1 || 
framework_failure_
      (ulimit -S -s 256 &&
        dd count="$long_multiplier" if=/dev/null of=/dev/null status=none) || 
fail=1
    fi

I suspect the CI machine got lucky (or unlucky, depending on ones
perspective) such that the first ulimit call succeeded but the second
one failed.

That test was added a month ago [1], and you mention it passing last
week. I feel that backs up my theory, so I pushed the attached patch to
address it.

Thanks,
Collin

[1] 
https://github.com/coreutils/coreutils/commit/4bf753a80154d6c518d9858ea4423cba40168470

>From fbd3072360fcea375d8ca7875bc96cc8d9937c4f Mon Sep 17 00:00:00 2001
Message-ID: <fbd3072360fcea375d8ca7875bc96cc8d9937c4f.1779150917.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Mon, 18 May 2026 17:25:43 -0700
Subject: [PATCH] tests: dd: avoid a false failure when ulimit fails

This test failure was seen on NetBSD 10.0 machine, where ulimit failed
with EINVAL.

* tests/dd/bytes.sh: Don't fail the test case if ulimit fails.
Reported by Bruno Haible.
---
 tests/dd/bytes.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/dd/bytes.sh b/tests/dd/bytes.sh
index fa7295ac8..013cc0006 100755
--- a/tests/dd/bytes.sh
+++ b/tests/dd/bytes.sh
@@ -71,8 +71,9 @@ done
 # Check that long multiplier chains don't exhaust a restricted stack.
 if (ulimit -S -s 256 && dd if=/dev/null count=1) 2>/dev/null; then
   long_multiplier=$(yes 1x | head -n 10000 | tr -d '\n')1 || framework_failure_
-  (ulimit -S -s 256 &&
-    dd count="$long_multiplier" if=/dev/null of=/dev/null status=none) || fail=1
+  (ulimit -S -s 256 && touch ulimit-worked &&
+    dd count="$long_multiplier" if=/dev/null of=/dev/null status=none) \
+      || { test -f ulimit-worked && fail=1; }
 fi
 
 # Negative checks for integer parsing
-- 
2.54.0

Reply via email to