From fc5bd8e8c364dc85628d3791057ae74387766298 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sat, 12 Feb 2022 15:41:15 +0000 Subject: [PATCH] tests/sh_match.sh: redirect ulimit to 2>/dev/null macOS 12.2.1 doesn't seem to like the -M, -v or -d ulimit options: sh_match.sh[502]: FAIL: test_xmlfragment1/0/testfile1.xml: Expected empty stderr, got $'test1_script.sh[2]: ulimit: 1048576: limit exceeded [Invalid argument]\ntest1_script.sh[3]: ulimit: 1048576: limit exceeded [Invalid argument]\ntest1_script.sh[4]: ulimit: 1048576: limit exceeded [Invalid argument]' The 'Invalid argument' addition is caused by errno==EINVAL and suggests the OS either doesn't support setting this limit, or support for it was somehow disabled. src/cmd/ksh93/tests/sh_match.sh: - Redirect standard error for ulimit commands to 2>/dev/null. If they fail it's pretty inconsequential and it's not related to actual ${.sh.match} testing at all. Resolves: https://github.com/ksh93/ksh/issues/459 Thanks to @posguy99 for the report. --- src/cmd/ksh93/tests/sh_match.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cmd/ksh93/tests/sh_match.sh b/src/cmd/ksh93/tests/sh_match.sh index ced31ea34..8379cedaa 100755 --- a/src/cmd/ksh93/tests/sh_match.sh +++ b/src/cmd/ksh93/tests/sh_match.sh @@ -130,9 +130,11 @@ function test_xmlfragment1 typeset -r testscript='test1_script.sh' cat >"${testscript}" <<-TEST1SCRIPT # memory safeguards to prevent out-of-control memory consumption - ulimit -M \$(( 1024 * 1024 )) - ulimit -v \$(( 1024 * 1024 )) - ulimit -d \$(( 1024 * 1024 )) + { + ulimit -M \$(( 1024 * 1024 )) + ulimit -v \$(( 1024 * 1024 )) + ulimit -d \$(( 1024 * 1024 )) + } 2>/dev/null # input text xmltext="\$( < "\$1" )" @@ -149,7 +151,7 @@ cat >"${testscript}" <<-TEST1SCRIPT nameref ar="\$1" # fixme: - # - We want to enforce standard conformance - does ~(Exp) or ~(Ex-p) does that ? + # - We want to enforce standard conformance - does ~(Exp) or ~(Ex-p) do that ? dummy="\${xmltext//~(Ex-p)(?: ()+?| # xml comments (<[:_[:alnum:]-]+