On 03/04/2012 04:34 PM, Stefano Lattarini wrote:
> On 03/04/2012 04:28 PM, Stefano Lattarini wrote:
>> On a Solaris 10 system:
>>
>> ERROR: 493 tests were run,
>> 7 failed (4 expected failures).
>> 10 tests were skipped.
>>
>> Details are attached.
>>
> The failure of test 75 was due to a testsuite weakness; I've just committed a
> fix for that to master.
>
And I can reduce the failure of test 74 as follows:

  $ echo '#!/bin/sh' > script
  $ sh script; echo status: $?
  sh: script: cannot execute
  status: 1

The failure only takes place with /bin/ksh and /usr/xpg4/bin/sh:

  $ /bin/sh script; echo status: $?
  status: 0
  $ /usr/local/bin/dash script; echo status: $?
  status: 0
  $ /bin/bash script; echo status: $?
  status: 0

What's going on there?  Anyway, the attached patch (already pushed to
master) fixes the issue.

Regards,
  Stefano
>From 43814d248d030849c366e83e550f90a88596461d Mon Sep 17 00:00:00 2001
Message-Id: <43814d248d030849c366e83e550f90a88596461d.1330877705.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Sun, 4 Mar 2012 17:14:14 +0100
Subject: [PATCH] tests: fix spurious failure due to Solaris XPG4 sh bug

On Solaris 10, the /usr/xpg4/bin/sh shell seems unable to execute
a shell script named 'script':

  $ touch script
  $ /bin/sh script; echo status: $? # As expected.
  status: 0
  $ /usr/xpg4/bin/sh script; echo status: $? # Weirdness follows.
  /usr/xpg4/bin/sh: script: cannot execute
  status: 1

This was causing a spurious testsuite failure for users which have
/usr/xpg4/bin in $PATH before /bin and /usr/bin.  Fix that.

* tests/m4sh.at (Configure re-execs self with CONFIG_SHELL): Rename
the m4sh-produced script to 'script2', to avoid the just-described
issue.
---
 tests/m4sh.at |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/m4sh.at b/tests/m4sh.at
index 78fe967..4e4da5d 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -49,6 +49,10 @@ echo foo > sentinel
 ]])
 AT_CHECK_M4SH
 
+# Calling the script simply 'script' could cause problems with
+# Solaris /usr/xpg4/bin/sh in the invocation 'sh script' below.
+mv -f script script2
+
 AT_DATA([fake-shell],
 [[#!/bin/sh
 echo 'Fake shell executed.'
@@ -61,7 +65,7 @@ done
 ]])
 chmod a+x fake-shell
 
-AT_CHECK([CONFIG_SHELL=./fake-shell ./script 1 2 4 8], [0],
+AT_CHECK([CONFIG_SHELL=./fake-shell ./script2 1 2 4 8], [0],
 [Fake shell executed.
 nargs = 4
  :1:
@@ -73,7 +77,7 @@ AT_CHECK([test ! -f sentinel], [0])
 test ! -f sentinel || rm -f sentinel # Cleanup for next test.
 
 AT_CHECK(
-[CONFIG_SHELL=`pwd`/fake-shell sh script a 'b  c' '  d	   e '],
+[CONFIG_SHELL=`pwd`/fake-shell sh script2 a 'b  c' '  d	   e '],
 [0],
 [Fake shell executed.
 nargs = 3
@@ -85,7 +89,7 @@ AT_CHECK([test ! -f sentinel], [0])
 test ! -f sentinel || rm -f sentinel # Cleanup for next test.
 
 AT_CHECK([(PATH=`pwd`:$PATH; export PATH;
-CONFIG_SHELL=fake-shell script '' '&' '!;*' '<($[]@%:@)>,' 'x
+CONFIG_SHELL=fake-shell script2 '' '&' '!;*' '<($[]@%:@)>,' 'x
 y  z
 1 2 3')], [0],
 [Fake shell executed.
-- 
1.7.9

Reply via email to