[openssl.org #1092] openssl-0.9.8-beta3 on ULTRIX 4.5 (/bin/sh)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[openssl.org #1092] openssl-0.9.8-beta3 on ULTRIX 4.5 (/bin/sh)

Rich Salz via RT

Environment: openssl-0.9.8-beta3, ULTRIX 4.5, default shell

ULTRIX's default shell (/bin/sh) is "a bit special", so I don't expect
to get this fixed. But for reference (and because these problems only
exist since openssl-0.9.7f) I'll report them:

(1) "test -x" unsupported (util/opensslwrap.sh)
   # echo "test -x /bin/sh" | /bin/sh
   test: argument expected
   # echo "test -f /bin/sh" | /bin/sh
   # echo "test -x /bin/sh" | /bin/ksh

   /bin/sh has no builtin "test" and /bin/test does not understand "-x".

(2) ":" in parameter substitution (Makefile.org, Makefile.shared)
   # echo "echo \${X:-x}" | /bin/sh
   /bin/sh: bad substitution
   # echo "echo \${X-x}" | /bin/sh
   x
   # echo "echo \${X:-x}" | /bin/ksh
   x

   Similar problem with "${X:=x}".

Workaround:
(1)  In util/opensslwrap.sh replace all (three) "-x" with "-f".
(2a) In Makefile.org, Makefile.shared replace :-/:= with -/= or
(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
      :

Bernhard Simon, TU Wien, ZID/StS

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [openssl.org #1092] openssl-0.9.8-beta3 on ULTRIX 4.5 (/bin/sh)

Rich Salz via RT

> Environment: openssl-0.9.8-beta3, ULTRIX 4.5, default shell
>
> ULTRIX's default shell (/bin/sh) is "a bit special", so I don't expect
> to get this fixed. But for reference (and because these problems only
> exist since openssl-0.9.7f) I'll report them:
>
> (1) "test -x" unsupported (util/opensslwrap.sh)
>    # echo "test -x /bin/sh" | /bin/sh
>    test: argument expected
>    # echo "test -f /bin/sh" | /bin/sh
>    # echo "test -x /bin/sh" | /bin/ksh
>
>    /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? What happens if you do following:

1. create following script as /tmp/test
        #!/bin/ksh
        `basename $0` "$@"
2. 'chmod a+x /tmp/test; ln /tmp/test /tmp/\['
3. 'PATH=/tmp:$PATH' or 'setenv PATH /tmp:$PATH', whichever appropriate;

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

> (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 nobody remembers or considers valid.
We could drop this information to FAQ, but given that you're one of very
few (if not only:-) person to compile it on Ultrix, ./PROBLEMS is
probably more appropriate. A.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [openssl.org #1092] openssl-0.9.8-beta3 on ULTRIX 4.5 (/bin/sh)

Rich Salz via RT
In reply to this post by Rich Salz via RT

> > 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                       [hidden email]
Automated List Manager                           [hidden email]