bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2.57f: config.status fails on solaris 2.6 (Was: Configure Problem on


From: Paul Eggert
Subject: Re: 2.57f: config.status fails on solaris 2.6 (Was: Configure Problem on Solaris 2.6)
Date: 15 Oct 2003 16:00:18 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Ralf Corsepius <address@hidden> writes:

> FWIW: With pdksh-5.2.14-21 under RH-9:
> 
> # /bin/ksh ./foo.sh
> ./foo.sh[2]: syntax error: `if' unmatched

Ah, perhaps the Solaris 2.6 implementation had pdksh installed.  That
would explain it.  Thanks.

I installed the following patch to work around this problem, and to
document the relevant ksh shellology.  (As usual in Autoconf: a
one-line change to the code, accompanied with dozens of lines of
changes to the documentation and comments! :-)


2003-10-15  Paul Eggert  <address@hidden>

        * lib/m4sugar/m4sh.m4 (_AS_UNSET_PREPARE): Work around a bug in
        pdksh 5.2.14.  Bug reported by Ralf Corsepius.
        * doc/autoconf.texi (Shellology): Mention the Korn shell and pdksh.
        Mention /usr/dt/bin/dtksh on Solaris.
        (Shell Substitutions): Warn about $((...)).
        (Parentheses): New section.
        
--- m4sh.m4.~1.102.~    Sun Sep 28 12:02:41 2003
+++ m4sh.m4     Wed Oct 15 13:43:13 2003
@@ -279,9 +279,10 @@ fi
 # AS_UNSET depends upon $as_unset: compute it.
 # Use MAIL to trigger a bug in Bash 2.01;
 # the "|| exit" suppresses the resulting "Segmentation fault" message.
+# Avoid 'if ((', as that triggers a bug in pdksh 5.2.14.
 m4_defun([_AS_UNSET_PREPARE],
 [# Support unset when possible.
-if ((MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
--- autoconf.texi.~1.768.~      Wed Oct 15 12:28:28 2003
+++ autoconf.texi       Wed Oct 15 15:52:46 2003
@@ -468,6 +468,7 @@ Portable Shell Programming
 * File System Conventions::     File- and pathnames
 * Shell Substitutions::         Variable and command expansions
 * Assignments::                 Varying side effects of assignments
+* Parentheses::                 Parentheses in shell scripts
 * Special Shell Variables::     Variables you should not change
 * Limitations of Builtins::     Portable use of not so portable /bin/sh
 * Limitations of Usual Tools::  Portable use of portable tools
@@ -9055,6 +9056,7 @@ There are other sources of documentation
 * File System Conventions::     File- and pathnames
 * Shell Substitutions::         Variable and command expansions
 * Assignments::                 Varying side effects of assignments
+* Parentheses::                 Parentheses in shell scripts
 * Special Shell Variables::     Variables you should not change
 * Limitations of Builtins::     Portable use of not so portable /bin/sh
 * Limitations of Usual Tools::  Portable use of portable tools
@@ -9125,12 +9127,31 @@ versions of @command{bash} (or with many
 you use @command{bash} 2.05 or higher to execute @command{configure},
 you'll need to use @command{bash} 2.05 for all other build tasks as well.
 
address@hidden @command{/usr/xpg4/bin/sh} on Solaris
address@hidden Ksh
address@hidden Ksh
address@hidden Korn shell
address@hidden @samp{ksh88}
address@hidden @samp{ksh93}
+The Korn shell is compatible with the Bourne family and it mostly
+conforms to @acronym{POSIX}.  It has two major variants commonly
+called @samp{ksh88} and @samp{ksh93}, named after the years of initial
+release.  It is usually called @command{ksh}, but Solaris systems have
+three variants:
address@hidden @command{/usr/bin/ksh} on Solaris
address@hidden/usr/bin/ksh} is @samp{ksh88},
 @prindex @command{/usr/xpg4/bin/sh} on Solaris
-The @acronym{POSIX}-compliant Bourne shell on a Solaris system is
address@hidden/usr/xpg4/bin/sh} and is part of an extra optional package.
-There is no extra charge for this package, but it is also not part of a
-minimal OS install and therefore some folks may not have it.
address@hidden/usr/xpg4/bin/sh} is a @acronym{POSIX}-compliant variant of
address@hidden, and
address@hidden @command{/usr/dt/bin/dtksh} on Solaris
address@hidden/usr/dt/bin/dtksh} is @samp{ksh93}.  @command{/usr/bin/ksh}
+is standard on Solaris; the other variants are parts of optional
+packages.  There is no extra charge for these packages, but they are
+not part of a minimal OS install and therefore some installations may
+not have it.
address@hidden @samp{pdksh}
+A public-domain clone of the Korn shell called @samp{pdksh} is also
+widely available: it has most of the @samp{ksh88} features along with
+a few of its own.
 
 @item Zsh
 @cindex Zsh
@@ -9669,6 +9690,13 @@ IRIX firebird-image 6.5 07151432 IP22
 $ @kbd{echo $(echo blah)}
 $(echo blah)
 @end example
+
+If you do use @samp{$(@var{commands})}, make sure that the commands
+do not start with a parenthesis, as that would cause confusion with
+a different notation @samp{$((@var{expression}))} that in modern
+shells is an arithmetic expression not a command.  To avoid the
+confusion, insert a space between the two opening parentheses.
+
 @end table
 
 
@@ -9755,6 +9783,36 @@ doubt, just use the latter.  @xref{Shell
 @address@hidden@var{var}:address@hidden@}} and 
@address@hidden@address@hidden@}}
 for the rationale.
 
address@hidden Parentheses
address@hidden Parentheses in Shell Scripts
+
+Beware of two opening parentheses in a row, as some shell
+implementations mishandle them.  For example, @samp{pdksh} 5.2.14
+misparses the following code:
+
address@hidden
+if ((true) || false); then
+  echo ok
+fi
address@hidden example
+
address@hidden
+To work around this problem, insert a space between the two opening
+parentheses.  There is a similar problem and workaround with
address@hidden((}; see @ref{Shell Substitutions}.
+
address@hidden requires support for @code{case} patterns with opening
+parentheses like this:
+
address@hidden
+case $filename in
+(*.c) echo "C source code";;
+esac
address@hidden example
+
address@hidden
+but the @code{(} in this example is not portable to many older Bourne
+shell implementations.  It can be omitted safely.
 
 @node Special Shell Variables
 @section Special Shell Variables




reply via email to

[Prev in Thread] Current Thread [Next in Thread]