This is mostly an FYI, as I don't think our ridiculous environment needs to
be supported, but the E2BIG test in exec3.sub never finishes in our testing
environment due to ARG_MAX being set to a huge number. I'm adding a patch
to limit the test to 2 MB ARG_MAX, though I don't know what the best value
limit might be generally. I wanted to share it in case it was useful.



>From c007e5ecb9b4aaeb36a71dcb3d6c249deef4ae71 Mon Sep 17 00:00:00 2001
From: Joel Ebel <jbe...@google.com>
Date: Sat, 7 Jun 2025 14:05:41 +0000
Subject: [PATCH] Limit ARG_MAX test to 2^21

If the testing environment has a huge ARG_MAX, then this test can last
forever. Limit ARG_MAX to 2 MB.
---
 tests/exec3.sub | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/exec3.sub b/tests/exec3.sub
index c8875bef..9cddc829 100644
--- a/tests/exec3.sub
+++ b/tests/exec3.sub
@@ -59,7 +59,7 @@ unset BASH_ENV
 rm -f x.sh x.output
 cat << \EOF > x.sh
 argmax=$(getconf ARG_MAX 2>/dev/null)
-if (( argmax <= 0 )); then
+if (( argmax <= 0 | argmax > 2097152)); then
         argmax=1048576
 fi
 v=$(echo {1..250000})
-- 
2.50.0.rc0.604.gd4ff7b7c86-goog
  • exec3.sub never f... Joel Ebel via Bug reports for the GNU Bourne Again SHell
    • Re: exec3.su... Martin D Kealey
      • Re: exec... Joel Ebel via Bug reports for the GNU Bourne Again SHell
        • Re: ... Chet Ramey
          • ... Joel Ebel via Bug reports for the GNU Bourne Again SHell
            • ... Joel Ebel via Bug reports for the GNU Bourne Again SHell
              • ... Chet Ramey
                • ... Joel Ebel via Bug reports for the GNU Bourne Again SHell
                • ... Chet Ramey
                • ... Joel Ebel via Bug reports for the GNU Bourne Again SHell
                • ... Chet Ramey

Reply via email to