Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 1217 invoked by uid 6000); 22 Apr 1998 07:04:17 -0000 Received: (qmail 1191 invoked from network); 22 Apr 1998 07:04:11 -0000 Received: from slarti.muc.de (193.174.4.10) by taz.hyperreal.org with SMTP; 22 Apr 1998 07:04:11 -0000 Received: (qmail 15726 invoked by uid 66); 22 Apr 1998 07:01:18 -0000 Received: by en1.engelschall.com (Sendmail 8.8.8) id JAA09180; Wed, 22 Apr 1998 09:00:06 +0200 (MET DST) Message-ID: <19980422090006.A2617@engelschall.com> Date: Wed, 22 Apr 1998 09:00:06 +0200 From: "Ralf S. Engelschall" To: new-httpd@apache.org Subject: Re: configure bug Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91i Organization: Engelschall, Germany. X-Home: http://www.engelschall.com/ Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org In article you wrote: > Ralf, the IFS settings in the configure script is causing me all sorts of > grief. There are a number of places where you have > IFS='' > As far as I can tell, these should be: > IFS='' > Did something perhaps go through and strip off trailing whitespaces on > lines? > I think it would be a good idea to always save the old IFS setting and put > this setting back after you are done with the current bit of parsing. No, it is ok at these places, because the for-loop iterates over the result of "grep" and should get one line per iteration. Hmmm.. but you are right, we should restore the IFS correctly at any point, i.e. we should really be paranoid here because wrong IFS can cause a lot of trouble inside braindead Bourne-Shell variants. How about the appended "maximum-paranoid" patch? Ralf S. Engelschall rse@engelschall.com www.engelschall.com Index: configure =================================================================== RCS file: /e/apache/REPOS/apache-1.3/configure,v retrieving revision 1.15 diff -u -r1.15 configure --- configure 1998/04/21 16:00:33 1.15 +++ configure 1998/04/22 06:57:42 @@ -61,6 +61,10 @@ ## Written by Ralf S. Engelschall ## +# default input separator chars: +DIFS=' +' + ## ## the paths to the Apache source tree ## @@ -111,8 +115,9 @@ ## PERL=no-perl-on-this-system -IFS=: +OIFS="$IFS" IFS=':' for dir in $PATH; do + OIFS="$IFS" IFS="$DIFS" for exe in perl5 perl miniperl; do if test -f "$dir/$exe"; then if test -x "$dir/$exe"; then @@ -120,7 +125,9 @@ fi fi done + IFS="$OIFS" done +IFS="$OIFS" PERL="`echo $PERL | sed -e 's://:/:'`" ## @@ -162,7 +169,7 @@ # determine rules rules="" rulelist="" -IFS=' +OIFS="$IFS" IFS=' ' for rule in `grep '^Rule' $src/Configuration.tmpl`; do rule=`echo "$rule" | sed -e 's/^Rule[ ]*//'` @@ -173,12 +180,13 @@ rules="$rules:$namelow" rulelist="$rulelist:$name=$arg" done +IFS="$OIFS" # determine modules rm -f $src/Configuration.apaci 2>/dev/null modules="" modulelist="" -IFS=' +OIFS="$IFS" IFS=' ' for module in `egrep '^[# ]*(Add|Shared)Module' $src/Configuration.tmpl`; do add=yes @@ -202,12 +210,12 @@ modulelist="${modulelist}*" fi done +IFS="$OIFS" # backward compatibility from old src/Configuration.tmpl # parameter names to the canonical Autoconf-style shell # variable names. -IFS=' -' +OIFS="$IFS" IFS="$DIFS" for var in CFLAGS LDFLAGS LIBS INCLUDES; do eval "val=\$EXTRA_$var" if [ ".$val" != . ]; then @@ -216,14 +224,14 @@ echo " + Hint: please use $var instead of EXTRA_$var next time" fi done +IFS="$OIFS" ## ## parse argument line options ## apc_prev="" -IFS=' -' +OIFS="$IFS" IFS="$DIFS" for apc_option do # if previous option needs an argument, assign it. @@ -457,16 +465,18 @@ module ) case $apc_optarg in all ) - IFS=: + OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "module_${module}=yes" done + IFS="$OIFS" ;; most ) - IFS=: + OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "module_${module}=yes" done + IFS="$OIFS" module_auth_db=no # not all platforms have -ldb module_mmap_static=no # not all platforms have mmap() module_so=no # not all platforms have dlopen() @@ -487,14 +497,15 @@ shared ) case $apc_optarg in max ) - IFS=: + OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "shared_${module}=yes" done + IFS="$OIFS" shared_so=no # because of bootstrapping ;; remain ) - IFS=: + OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "add=\$module_${module}" if [ ".$add" = .no ]; then @@ -502,6 +513,7 @@ eval "shared_${module}=yes" fi done + IFS="$OIFS" shared_so=no ;; * ) @@ -544,10 +556,11 @@ module ) case $apc_optarg in all ) - IFS=: + OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "module_${module}=no" done + IFS="$OIFS" ;; * ) eval "exists=\$module_${apc_optarg}" @@ -562,10 +575,11 @@ shared ) case $apc_optarg in all ) - IFS=: + OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "shared_${module}=no" done + IFS="$OIFS" ;; * ) eval "exists=\$module_${apc_optarg}" @@ -597,6 +611,7 @@ ;; esac done +IFS="$OIFS" if [ ".$apc_prev" != . ]; then echo "configure:Error: missing argument to --`echo $apc_prev | sed 's/_/-/g'`" 1>&2 exit 1 @@ -616,7 +631,7 @@ ## expand path variables and make sure ## they do not end with a backslash ## -IFS=' ' +OIFS="$IFS" IFS="$DIFS" for var in prefix exec_prefix bindir sbindir \ libexecdir mandir sysconfdir datadir \ localstatedir includedir; do @@ -637,6 +652,7 @@ ;; esac done +IFS="$OIFS" ## ## determine special configurable Makefile targets @@ -766,8 +782,7 @@ touch sedsubst # generate settings from imported environment variables -IFS=' -' +OIFS="$IFS" IFS="$DIFS" for var in CC OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LDFLAGS_SHLIB \ LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB; do eval "val=\$$var"; @@ -783,9 +798,10 @@ eval "$var=\"\"; export $var" fi done +IFS="$OIFS" # generate rule directives -IFS=: +OIFS="$IFS" IFS=':' for rule in `echo "$rules" | sed -e 's/^://'`; do name="`echo $rule | tr "a-z" "A-Z"`" eval "val=\$rule_$rule" @@ -794,16 +810,18 @@ echo " + Rule $name=$val" fi done +IFS="$OIFS" # consistency checks for shared object support some_shares=0 -IFS=: +OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "share=\$shared_$module" if [ $share = yes ]; then some_shares=1 fi done +IFS="$OIFS" if [ $some_shares = 1 ]; then if [ $module_so = no ]; then module_so=yes @@ -819,7 +837,7 @@ fi # generate module directives -IFS=: +OIFS="$IFS" IFS=':' for module in `echo "$modules" | sed -e 's/^://'`; do eval "add=\$module_$module" if [ $add = yes ]; then @@ -840,6 +858,7 @@ echo " + Module $module: $m" fi done +IFS="$OIFS" # and finally translate the config template according to our situation if [ -f $src/Configuration.apaci ]; then