[patch] to gcc: shell portability problem in fixinc
Michael Sokolov
msokolov@ivan.Harhan.ORG
Sun Dec 24 10:13:00 GMT 2000
Hi there,
The patch below fixes a shell portability bug in gcc's fixinc system. In the
real Bourne shell (i.e., sh by Steve Bourne) on true UNIX systems such as
4.3BSD, the following construct:
if false; then
<do something>
fi
returns 1, the result of the false condition, making this construct unusable in
Makefiles as such. The most straightforwsrd fix is to amend it as:
if false; then
<do something>
else
true
fi
Fortunately, most GNU software handles this correctly, but a bug has crept into
the recent gcc which the patch below fixes.
--
Michael Sokolov
Public Service Agent
International Engineering and Science Task Force
1351 VINE AVE APT 27 Phone: +1-714-738-5409
FULLERTON CA 92833-4291 USA (home office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP)
2000-12-24 Michael Sokolov <msokolov@ivan.Harhan.ORG>
* fixinc/Makefile.in (install-bin): Add an else true to the if so that
it doesn't fail the make when false with the original Bourne shell.
Index: fixinc/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/Makefile.in,v
retrieving revision 1.31
diff -p -r1.31 Makefile.in
*** Makefile.in 2000/12/13 20:07:45 1.31
--- Makefile.in 2000/12/24 15:50:09
*************** maintainer-clean : clean
*** 117,123 ****
install-bin : $(TARGETS)
./fixincl -v
@if [ -f ../fixinc.sh ] ; then rm -f ../fixinc.sh || \
! mv -f ../fixinc.sh ../fixinc.sh.$$ || exit 1 ; fi
@cp $(srcdir)/fixincl.sh ../fixinc.sh
chmod 755 ../fixinc.sh
--- 117,123 ----
install-bin : $(TARGETS)
./fixincl -v
@if [ -f ../fixinc.sh ] ; then rm -f ../fixinc.sh || \
! mv -f ../fixinc.sh ../fixinc.sh.$$ || exit 1 ; else true ; fi
@cp $(srcdir)/fixincl.sh ../fixinc.sh
chmod 755 ../fixinc.sh
More information about the Gcc-patches
mailing list