> > Environment: openssl-0.9.8-beta3, ULTRIX 4.5, default shell
> > 
> >    /bin/sh has no builtin "test" and /bin/test does not understand "-x".
> 
> I wonder if you could be so kind and answer few questions? How does your 
> /bin/sh handle if [ ... ] or [ ... ] || ... ? Does it execute /bin/[ or 
> /bin/test even then?

It executes "/bin/[" as shown below.

   # ls -l /bin/\[ /bin/test
   -rwxr-xr-x  2 root     system      12288 Oct 18  1995 /bin/[
   -rwxr-xr-x  2 root     system      12288 Oct 18  1995 /bin/test
   # cat t1.sh
   #!/bin/sh
   [ -f /bin/sh ] && echo /bin/sh exists and is a regular file
   [ -x /bin/sh ] && echo /bin/sh exists and has execute permission
   # ./t1.sh
   /bin/sh exists and is a regular file
   test: argument expected
   # mv /bin/\[ /bin/\[.SAV
   # ./t1.sh
   sh: [: not found
   sh: [: not found
   # mv /bin/\[.SAV /bin/\[

>                  ... What happens if you do following:

   # cat > /tmp/test << EOF
   #!/bin/ksh
   \`basename \$0\` "\$@"
   EOF
   # cat /tmp/test
   #!/bin/ksh
   `basename $0` "$@"
   # chmod 755 /tmp/test; ln /tmp/test /tmp/\[
   # ls -l /tmp/\[ /tmp/test
   -rwxr-xr-x  2 root     system         30 Jun  2 10:56 /tmp/[
   -rwxr-xr-x  2 root     system         30 Jun  2 10:56 /tmp/test
   # PATH=/tmp:$PATH ./t1.sh
   /bin/sh exists and is a regular file
   /bin/sh exists and has execute permission

> Does -x work in /bin/sh scripts then?

Yes, it works!

Remark: In teTeX, Thomas Esser avoids ULTRIX's /bin/sh problems with

   test -f /bin/ksh && test -z "$RUNNING_KSH" \
     && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
     && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; }
   unset RUNNING_KSH

after "#!/bin/sh" in some of his scripts.

> > (2b) keep Makefile.org, Makefile.shared unchanged and force "make" to use
> >      a different shell with PROG_ENV=POSIX MAKESHELL=<better_shell>, e.g.
> >      PROG_ENV=POSIX MAKESHELL=/bin/ksh ./Configure ...
> >      PROG_ENV=POSIX MAKESHELL=/bin/ksh make
> 
> As you may imagine, I'd prefer to provide/document workaround[s] than 
> modify code to adopt ancient syntax ...
>                                                 ... ./PROBLEMS is 
> probably more appropriate. A.

Yes, PROBLEMS seems to be a good place to document this (and to
use "no-sha512" and "-DVMS_TEST" with ULTRIX's cc).

Bernhard Simon, TU Wien, ZID/StS

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to