develooper Front page | perl.perl5.porters | Postings from January 2001

[PATCH] 8297. Symlink stuff breaks on AIX 4 bsh

Thread Next
From:
H . Merijn Brand
Date:
January 2, 2001 02:30
Subject:
[PATCH] 8297. Symlink stuff breaks on AIX 4 bsh
Message ID:
20010102093747.A6F7.H.M.BRAND@hccnet.nl
AIX 4's bsh, which is for valid reasons a replacement for the default sh, has a
bogus test builtin, which is revealed by the 8218 symlink patch. bsh's test
does *NOT* support the -h option, but Configure does not take into account that
we're running in a replacement sh!

I don't know if the attached patch is complete, but it is for sure a lot more
reliable!

% sh
$ test -h sym
$
% ksh
$ test -h sym
$
% bsh
$ test -h sym
test: 0402-017 Specify a parameter with this command.
$
%

I've checked for '-h' to disable test fallback to builtin. This might be not
the way to go, but for now it works. Better solutions welcome.

IMHO, I think the $sh_c solution should go in 5.6.1 ASAP

--8<--- Configure.diff
*** Configure	Thu Dec 21 17:27:30 2000
--- Configure	Tue Jan  2 11:17:07 2001
***************
*** 146,151 ****
--- 146,156 ----
  	;;
  esac
  
+ case "$newsh" in
+     '') sh_c="sh -c" ;;
+     *)  sh_c="$newsh -c" ;;
+     esac
+ 
  : if needed set CDPATH to a harmless value that is not chatty
  : avoid bash 2.02 problems with empty CDPATH.
  case "$CDPATH" in
***************
*** 2059,2069 ****
  	echo "Hopefully test is built into your sh."
  	;;
  *)
! 	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
  		echo "Using the test built into your sh."
  		test=test
  		_test=test
! 	fi
  	;;
  esac
  case "$echo" in
--- 2064,2081 ----
  	echo "Hopefully test is built into your sh."
  	;;
  *)
! 	if `$sh_c "PATH= test true" >/dev/null 2>&1`; then
! 	    ln -s /dev/null test_h
! 	    $sh_c "PATH= test -h test_h" >/dev/null 2>&1
! 	    if [ $? = 0 ]; then
  		echo "Using the test built into your sh."
  		test=test
  		_test=test
! 	    else
! 		echo "Builtin 'test' is bogus. Using $test instead."
! 		fi
! 	    rm test_h
! 	    fi
  	;;
  esac
  case "$echo" in
***************
*** 4138,4145 ****
  
  EOM
  dflt=y
! if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
! 	if sh -c './try' >>try.msg 2>&1; then
  		xxx=`./try`
  		case "$xxx" in
  		"Ok") dflt=n ;;
--- 4150,4157 ----
  
  EOM
  dflt=y
! if $sh_c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
! 	if $sh_c './try' >>try.msg 2>&1; then
  		xxx=`./try`
  		case "$xxx" in
  		"Ok") dflt=n ;;
***************
*** 7121,7127 ****
  case "$myhostname" in
  '') cont=true
  	echo 'Maybe "hostname" will work...'
! 	if tans=`sh -c hostname 2>&1` ; then
  		myhostname=$tans
  		phostname=hostname
  		cont=''
--- 7133,7139 ----
  case "$myhostname" in
  '') cont=true
  	echo 'Maybe "hostname" will work...'
! 	if tans=`$sh_c hostname 2>&1` ; then
  		myhostname=$tans
  		phostname=hostname
  		cont=''
***************
*** 7144,7160 ****
  fi
  if $test "$cont"; then
  	echo 'No, maybe "uuname -l" will work...'
! 	if tans=`sh -c 'uuname -l' 2>&1` ; then
  		myhostname=$tans
  		phostname='uuname -l'
  	else
  		echo 'Strange.  Maybe "uname -n" will work...'
! 		if tans=`sh -c 'uname -n' 2>&1` ; then
  			myhostname=$tans
  			phostname='uname -n'
  		else
  			echo 'Oh well, maybe I can mine it out of whoami.h...'
! 			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
  				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
  				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
  			else
--- 7156,7172 ----
  fi
  if $test "$cont"; then
  	echo 'No, maybe "uuname -l" will work...'
! 	if tans=`$sh_c 'uuname -l' 2>&1` ; then
  		myhostname=$tans
  		phostname='uuname -l'
  	else
  		echo 'Strange.  Maybe "uname -n" will work...'
! 		if tans=`$sh_c 'uname -n' 2>&1` ; then
  			myhostname=$tans
  			phostname='uname -n'
  		else
  			echo 'Oh well, maybe I can mine it out of whoami.h...'
! 			if tans=`$sh_c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
  				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
  				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
  			else
***************
*** 7255,7261 ****
  		esac
  		case "$dflt" in
  		.) echo "(No help from resolv.conf either -- attempting clever guess)"
! 			dflt=.`sh -c domainname 2>/dev/null`
  			case "$dflt" in
  			'') dflt='.';;
  			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
--- 7267,7273 ----
  		esac
  		case "$dflt" in
  		.) echo "(No help from resolv.conf either -- attempting clever guess)"
! 			dflt=.`$sh_c domainname 2>/dev/null`
  			case "$dflt" in
  			'') dflt='.';;
  			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e
  			's/^\.[^.]*//'`;;
End of Patch
-->8---

-- 
H.Merijn Brand           Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.005.03, 5.6.0, 5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2
   AIX 4.3, WinNT 4.0 SP-6a, and Win2000pro often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About