autoconf-patches
[Top][All Lists]
Advanced

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

Re: [configure bug while building] flex beta version 2.5.15


From: Paul Eggert
Subject: Re: [configure bug while building] flex beta version 2.5.15
Date: Sun, 1 Sep 2002 01:41:13 -0700 (PDT)

> Date: Fri, 30 Aug 2002 22:58:59 -0400
> From: Bruce Lilly <address@hidden>

> It was reported as a bug in the bison 1.33 configure
> script ca. 22 Feb 2002.

Thanks, I found that bug report in
<http://mail.gnu.org/pipermail/bug-bison/2002-February/001279.html>.

I don't understand the IFS problem that it mentions.  The current CVS
Autoconf outputs a script that sets IFS to space, tab, newline early
on.  Perhaps you were using an older Autoconf that didn't do that?

Also, the bug report mentioned PS3, but I'd rather leave PS3 alone as
it's not specified by POSIX 1003.1-2001.  Portable scripts don't use
"select" and don't rely on $? from "select", so I don't think PS3 is a
real problem.

However, I think ENV, MAIL, and MAILPATH should be unset, as they
might cause similar problems with a buggy shell like the one that you
describe.  While fixing this problem I noticed that LC_ALL etc. aren't
being set properly, so I fixed that too.  So I installed the following
patch; it should at least fix your PS1 problem.

2002-09-01  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (Special Shell Variables): Mention
        ENV, MAIL, MAILPATH, PS1, PS2, PS4.  Index PWD.

        * lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Unset ENV, MAIL,
        MAILPATH and set PS1, PS2, PS4 to default values, to work
        around bug in pre-3.0 UWIN ksh reported by Bruce Lilly.
        For LC_ALL etc, first try to set to "C" as POSIX requires and as
        the Autoconf documentation specifies; fall back to "unset" only if
        this fails.  Use a shell for-loop for this rather than an m4 loop,
        to shorten the output script.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.656
retrieving revision 1.658
diff -p -u -r1.656 -r1.658
--- doc/autoconf.texi   31 Aug 2002 05:46:05 -0000      1.656
+++ doc/autoconf.texi   1 Sep 2002 08:36:52 -0000       1.658
@@ -9013,7 +9013,7 @@ Autoconf-generated scripts normally set 
 @sc{posix} requires that @env{LC_ALL} be set to @samp{C} if the C
 locale is desired.  However, some older, nonstandard systems (notably
 @sc{sco}) break if @env{LC_ALL} is set to @samp{C}, so when running on
-these systems Autoconf-generated scripts first try to unset the
+these systems Autoconf-generated scripts unset the
 variables instead.
 
 @item LANGUAGE
@@ -9120,7 +9120,34 @@ When executing the command @samp{>foo}, 
 sets @code{NULLCMD} to @samp{cat}.  If you forgot to set @code{NULLCMD},
 your script might be suspended waiting for data on its standard input.
 
address@hidden ENV
address@hidden MAIL
address@hidden MAILPATH
address@hidden PS1
address@hidden PS2
address@hidden PS4
address@hidden ENV
address@hidden MAIL
address@hidden MAILPATH
address@hidden PS1
address@hidden PS2
address@hidden PS4
+These variables should not matter for shell scripts, since they are
+supposed to affect only interactive shells.  However, at least one
+shell (the pre-3.0 @sc{uwin} @command{ksh}) gets confused about
+whether it is interactive, which means that (for example) a @env{PS1}
+with a side effect can unexpectedly modify @samp{$?}.  To work around
+this bug, Autoconf-generated scripts do something like this:
+
address@hidden
+(unset ENV) >/dev/null 2>&1 && unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
address@hidden example
+
 @item PWD
address@hidden PWD
 @acronym{POSIX} 1003.1-2001 requires that @command{cd} and
 @command{pwd} must update the @env{PWD} environment variable to point
 to the logical path to the current directory, but traditional shells
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.86
retrieving revision 1.87
diff -p -u -r1.86 -r1.87
--- lib/m4sugar/m4sh.m4 31 Aug 2002 05:48:04 -0000      1.86
+++ lib/m4sugar/m4sh.m4 1 Sep 2002 08:24:04 -0000       1.87
@@ -153,14 +153,23 @@ elif test -n "${BASH_VERSION+set}" && (s
   set -o posix
 fi
 
-# NLS nuisances.
 _AS_UNSET_PREPARE
-m4_foreach([_AS_var],
-  [LANG, LC_ALL, LC_TIME, LC_CTYPE, LANGUAGE,
-   LC_COLLATE, LC_NUMERIC, LC_MESSAGES],
-  [(set +x; test -n "`(_AS_var=C; export _AS_var) 2>&1`") &&
-    { AS_UNSET(_AS_var, C); }
-])
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES 
LC_TIME
+do
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
 
 # Required to use basename.
 _AS_EXPR_PREPARE




reply via email to

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