automake
[Top][All Lists]
Advanced

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

depcomp bug (was [Fwd: CVS update: ccvs])


From: Derek R. Price
Subject: depcomp bug (was [Fwd: CVS update: ccvs])
Date: Thu, 05 Apr 2001 10:29:06 -0400

Hey folks!

One of the other CVS developers reported a bug in depcomp on BSD/OS.
Apparently the included /bin/sh doesn't set $? inside of the
conditional.  His original message and fix are attached.

Derek

--
Derek Price                      CVS Solutions Architect ( http://CVSHome.org )
mailto:address@hidden         CollabNet ( http://collab.net )
--
Boy:  A noise with dirt on it


--- Begin Message --- Subject: Re: CVS update: ccvs Date: Wed, 4 Apr 2001 14:53:44 -0400 (EDT)
Derek R. Price writes:
> > * depcomp: Don't count on $? being set in then or else clauses.
> 
> What system is this happening on?  depcomp is part of the Automake
> distribution.

Boy, that was fast!  I was going to send you a message suggesting that
you pass that change on to the Automake folks, but you beat me to it. 
It happens on my BSD/OS system with bin/sh (but not with bash or ksh). 

Looking at the SUS-2 specs for sh:

        http://www.opengroup.org/onlinepubs/7908799/xcu/chap2.html

I don't see any requirement that the exit status of the conditional be
available in $? in the then and else clauses and given one counter
example and the fact that it's easy enough to work around, it seems like
the prudent thing to do.

-Larry Jones

He's just jealous because I accomplish so much more than he does. -- Calvin

--- End Message ---
Index: depcomp
===================================================================
RCS file: /home2/cvsroot/ccvs/depcomp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- depcomp     2000/12/21 22:14:19     1.1
+++ depcomp     2001/04/04 18:21:01     1.2
@@ -61,9 +61,9 @@
   if test -z "$gccflag"; then
     gccflag=-MD,
   fi
-  if "$@" -Wp,"$gccflag$tmpdepfile"; then :
-  else
-    stat=$?
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat != 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -102,9 +102,9 @@
   # trick.  Instead we must use -M and then rename the resulting .d
   # file.  This is also the case for older versions of gcc, which
   # don't implement -Wp.
-  if "$@" -MD; then :
-  else
-    stat=$?
+  "$@" -MD
+  stat=$?
+  if test $stat != 0; then
     rm -f FIXME
     exit $stat
   fi
@@ -118,9 +118,7 @@
     "$@" -MDupdate "$tmpdepfile"
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
-    stat=$?
+  if test $stat != 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi

reply via email to

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