httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject [PATCH] config/1159: Configure always returns exit code of 0 (fwd)
Date Thu, 25 Sep 1997 04:51:03 GMT
This is against 1.2.  A similar problem may exist in 1.3.

I've redone the patch as a unified diff.

+1

Dean

---------- Forwarded message ----------
Date: Mon, 22 Sep 1997 17:00:13 -0700 (PDT)
From: "A. Poindexter" <alan_poindexter@bmc.com>
To: apache-bugdb@apache.org
Cc: apache-bugdb@apache.org
Subject: config/1159: Configure always returns exit code of 0


>Number:         1159
>Category:       config
>Synopsis:       Configure always returns exit code of 0
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Sep 22 17:00:02 1997
>Originator:     alan_poindexter@bmc.com
>Organization:
apache
>Release:        1.2.4
>Environment:
SunOS xxxx 5.5.1 Generic sun4u sparc SUNW,Ultra-2

But will occur on any platform

Note: I search the bug reports, etc. I humbly appologize if this has already been reported

and I missed it.
>Description:
Configure in version 1.2.4 has six(6) exit 1's in it, but the secound line of Configure is
trap 'rm -f $tmpfile; exit' 0 1 2 3 15

notice no argument to exit.

now, consulting the man page for exit gives
  sh
     exit [ n ]

sh
     exit will cause the calling shell or shell  script  to  exit
     with  the  exit  status specified by n.  If n is omitted the
     exit status is that of the last  command  executed  (an  EOF
     will also cause the shell to exit.)

since the last command executed is rm and the temp file exists, Configure returns 
a 0 even if there was an error and Configure tried to exit with a 1 (trap called 
with exit code = 1)
>How-To-Repeat:
Set your path such that there is no cc compilier, run Confgure and examine the exit code
the script I used was:

./Configure
echo $?
>Fix:
here is a diff, <is the original Config, >is the changes I made

--- Configure.orig	Thu Aug 21 15:56:20 1997
+++ Configure	Wed Sep 24 21:48:38 1997
@@ -1,5 +1,5 @@
 #!/bin/sh
-trap 'rm -f $tmpfile; exit' 0 1 2 3 15
+trap 'rm -f $tmpfile; exit $exitCode' 0 1 2 3 15
 
 # Apache configuration script, first cut --- rst.
 # Dont like it?  Inspired to do something better?  Go for it.
@@ -23,12 +23,14 @@
     shift 1; file=$1; shift 1
     if [ ! -r $file ]; then
       echo "$file does not exist or is not readable."
+      exitCode=1
       exit 1
     fi
   elif [ "x$1" = "x-make" ] ; then
     shift 1; makefile_tmpl=$1; shift 1
     if [ ! -r $makefile_tmpl ]; then
       echo "$makefile_tmpl does not exist or is not readable."
+      exitCode=1
       exit 1
     fi
   else
@@ -41,6 +43,7 @@
 
 if [ ! -r $file ]; then
   echo "Can't see or read \"$file\""
+  exitCode=1
   exit 1
 fi
 
@@ -64,6 +67,7 @@
    echo "options or Configure rules, and I don't see that at all:"
    egrep -v '^Module[ 	]+[A-Za-z0-9_]+[ 	]+[^ 	]+$' $tmpfile | \
      grep -v =
+   exitCode=1
    exit 1
 fi
 
@@ -499,6 +503,7 @@
 	echo apache-bugs@apache.org.  If you don\'t wish to do the port
 	echo yourself, please submit this output rather than the patches.
 	echo Thank you
+        exitCode=1
 	exit 1
 	;;
 esac
@@ -545,6 +550,7 @@
 	    echo "Error: could not find any of these C compilers"
 	    echo " anywhere in your PATH: $lookedfor"
 	    echo "Configure terminated"
+            exitCode=1
 	    exit 1
 	fi
 	CC=$COMPILER


Mime
View raw message