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

4 messages from 2012-03-02 to 2012-03-02. Participants: Stefano Lattarini, Junio C Hamano.
Thread: https://gitlist.dev/t/29811

## Stefano Lattarini, 2012-03-02 10:33

Subject: [PATCH] tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh
Message-ID: <f3294212cbaf9bc0d6446d2cdf13619d0317b9e4.1330684369.git.stefano.lattarini@gmail.com>
URL: https://gitlist.dev/e/f3294212cbaf9bc0d6446d2cdf13619d0317b9e4.1330684369.git.stefano.lattarini%40gmail.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

```

## Junio C Hamano, 2012-03-02 18:38

Subject: Re: [PATCH] tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh
Message-ID: <7vd38uetls.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd38uetls.fsf%40alter.siamese.dyndns.org
In-Reply-To: <f3294212cbaf9bc0d6446d2cdf13619d0317b9e4.1330684369.git.stefano.lattarini@gmail.com>

```
This patch looks good, but please sign-off.

```

## Stefano Lattarini, 2012-03-02 18:48

Subject: [PATCH v2] tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh
Message-ID: <f2243a179ce49eed668341a6c0e3a452bf7ae79f.1330713761.git.stefano.lattarini@gmail.com>
URL: https://gitlist.dev/e/f2243a179ce49eed668341a6c0e3a452bf7ae79f.1330713761.git.stefano.lattarini%40gmail.com
In-Reply-To: <7vd38uetls.fsf@alter.siamese.dyndns.org>

```
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.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---

 Changes from the previous version: add a proper "Signed-off-by" line,
 which I had forgotten in the previous version.  Sorry for the confusion.

 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

```

## Junio C Hamano, 2012-03-02 22:41

Subject: Re: [PATCH v2] tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh
Message-ID: <7v62embp85.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v62embp85.fsf%40alter.siamese.dyndns.org
In-Reply-To: <f2243a179ce49eed668341a6c0e3a452bf7ae79f.1330713761.git.stefano.lattarini@gmail.com>

```
Thanks.

```
