bug-bison
[Top][All Lists]
Advanced

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

Re: Small glitch in bootstrap


From: Paul Eggert
Subject: Re: Small glitch in bootstrap
Date: Sun, 30 Oct 2005 16:13:55 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Paul Hilfinger <address@hidden> writes:

> What is this line (line 87 in my version) in the 'bootstrap' script
> supposed to do?
>
>     trap - 0

It means reset the exit trap to the default value, i.e., do nothing on exit.

> On Solaris, at least, it gives an annoying error message at the end of
> the bootstrap process.  On that OS, it should be
>
>    trap 0 

Yes, that's the old Unix version 7 way of doing things.  But POSIX
<http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html>
says it's not portable and if memory serves it causes bootstrap to
fail on some hosts.  So I changed it to the POSIX way a while ago.
(Aren't standards wonderful?)

Come to think of it, the current approach is buggy, since it doesn't
reset the traps for signals 1 2 13 and 15, And I see some other issues
as well.  I installed the following patch; it should fix your problem
in the normal case (the only problem is a confusing message if you
interrupt while fetching gnulib, but I don't offhand see how to fix
that for the Solaris shell).

2005-10-30  Paul Eggert  <address@hidden>

        * bootstrap (cleanup_gnulib): New function.  Use it to clean up
        gnulib when interrupted.  This fixes some race conditions and
        works around some portability problems (one noted by Paul
        Hilfinger).

--- bootstrap   2 Oct 2005 21:24:11 -0000       1.31
+++ bootstrap   31 Oct 2005 00:11:48 -0000      1.32
@@ -58,6 +58,12 @@ build_cvs_prefix() {
   fi
 }
 
+cleanup_gnulib() {
+  status=$?
+  rm -fr gnulib
+  exit $status
+}
+
 # Get gnulib files.
 
 case ${GNULIB_SRCDIR--} in
@@ -65,9 +71,6 @@ case ${GNULIB_SRCDIR--} in
   if [ ! -d gnulib ]; then
     echo "$0: getting gnulib files..."
 
-    trap exit 1 2 13 15
-    trap 'rm -fr gnulib; exit 1' 0
-
     case ${CVS_AUTH-anoncvs} in
     anoncvs)
       CVS_PREFIX='anoncvs@';;
@@ -82,9 +85,12 @@ case ${GNULIB_SRCDIR--} in
     '') export CVS_RSH=ssh;;
     esac
 
-    cvs -z3 -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib 
|| exit
+    trap cleanup_gnulib 1 2 13 15
+
+    cvs -z3 -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib ||
+      cleanup_gnulib
 
-    trap - 0
+    trap - 1 2 13 15
   fi
   GNULIB_SRCDIR=gnulib
 esac




reply via email to

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