git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh

From
Stefano Lattarini <stefano.lattarini@gmail.com>
Date
Mar 2, 2012, 10:33 UTC
Message-ID
<f3294212cbaf9bc0d6446d2cdf13619d0317b9e4.1330684369.git.stefano.lattarini@gmail.com>

If any test script is run directly with Solaris 10 /usr/xpg4/bin/sh or /bin/ksh, it fails spuriously with a message like:

  t0000-basic.sh[31]: unset: bad argument count
This happens because those shells bail out when encountering a call to
"unset" with no arguments, and such unset call could take place in
'test-lib.sh'.  Fix that issue, and add a proper comment to ensure we
don't regress in this respect.
---
 t/test-lib.sh |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a089a18..c0d04c4 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -42,10 +42,11 @@ TZ=UTC
 TERM=dumb
 export LANG LC_ALL PAGER TERM TZ
 EDITOR=:
-unset VISUAL
-unset EMAIL
-unset LANGUAGE
-unset $(perl -e '
+# A call to "unset" with no arguments causes at least Solaris 10
+# /usr/xpg4/bin/sh and /bin/ksh to bail out.  So keep the unsets
+# deriving from the command substitution clustered with the other
+# ones.
+unset VISUAL EMAIL LANGUAGE $(perl -e '
 	my @env = keys %ENV;
 	my $ok = join("|", qw(
 		TRACE
-- 
1.7.9
Next: Junio C Hamano
Message 1 of 4 in “tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh”
  1. tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/shStefano Lattarini, Mar 2, 2012
  2. Junio C HamanoMar 2, 2012
  3. tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/shStefano Lattarini, Mar 2, 2012
  4. Junio C HamanoMar 2, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.