From 7bb1f82b5e617bf24e6a511b4db1a375bf4d03e4 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 8 Jun 2002 16:56:11 +0000 Subject: [PATCH] For PR automake/317: * Makefile.am (maintainer-check): Disallow `for f in $(FILES)', suggest `list='$(FILES)'; for f in $$list' instead. * lib/am/distdir.am (distdir): Adjust `for' usage. * lib/am/texinfos.am (maintainer-clean-aminfo): Likewise. * tests/dollar.test: New file. * tests/Makefile.am (TESTS): Add dollar.test. Reported by Eric Siegerman and Philip Fong. --- ChangeLog | 11 +++++++++++ Makefile.am | 7 +++++++ Makefile.in | 8 ++++++-- THANKS | 2 ++ lib/Automake/Makefile.in | 4 ++-- lib/Makefile.in | 4 ++-- lib/am/Makefile.in | 4 ++-- lib/am/distdir.am | 2 +- lib/am/texinfos.am | 2 +- m4/Makefile.in | 4 ++-- tests/Makefile.am | 1 + tests/Makefile.in | 3 ++- tests/dollar.test | 30 ++++++++++++++++++++++++++++++ 13 files changed, 69 insertions(+), 13 deletions(-) create mode 100755 tests/dollar.test diff --git a/ChangeLog b/ChangeLog index 69a66b93b..3dda149ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-06-08 Alexandre Duret-Lutz + + For PR automake/317: + * Makefile.am (maintainer-check): Disallow `for f in $(FILES)', + suggest `list='$(FILES)'; for f in $$list' instead. + * lib/am/distdir.am (distdir): Adjust `for' usage. + * lib/am/texinfos.am (maintainer-clean-aminfo): Likewise. + * tests/dollar.test: New file. + * tests/Makefile.am (TESTS): Add dollar.test. + Reported by Eric Siegerman and Philip Fong. + 2002-06-06 Alexandre Duret-Lutz For PR automake/47 (fixed a long time ago): diff --git a/Makefile.am b/Makefile.am index 1b47d2723..c4685258e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,6 +91,13 @@ maintainer-check: automake aclocal echo "Suspicious 'rm' invocation." 1>&2; \ exit 1; \ else :; fi +## Never use something like `for file in $(FILES)', this doesn't work +## if FILES is empty or if it contains shell meta characters (e.g. $ is +## commonly used in Java filenames). + @if egrep 'for .* in \$$\(' $(srcdir)/lib/am/[a-z]*.am; then \ + echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \ + exit 1; \ + else :; fi ## Make sure all invocations of mkinstalldirs are correct. @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \ grep -F -v '$$(mkinstalldirs)'; then \ diff --git a/Makefile.in b/Makefile.in index 8878d4520..67c220cfd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -250,7 +250,7 @@ mostlyclean-aminfo: maintainer-clean-aminfo: cd $(srcdir) && \ - for i in $(INFO_DEPS); do \ + list='$(INFO_DEPS)'; for i in $$list; do \ rm -f $$i; \ if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ rm -f $$i-[0-9]*; \ @@ -369,7 +369,7 @@ distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkinstalldirs) $(distdir)/. $(distdir)/m4 - @for file in $(DISTFILES); do \ + @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -629,6 +629,10 @@ maintainer-check: automake aclocal echo "Suspicious 'rm' invocation." 1>&2; \ exit 1; \ else :; fi + @if egrep 'for .* in \$$\(' $(srcdir)/lib/am/[a-z]*.am; then \ + echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \ + exit 1; \ + else :; fi @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \ grep -F -v '$$(mkinstalldirs)'; then \ echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \ diff --git a/THANKS b/THANKS index 1ac83599c..44952f9a8 100644 --- a/THANKS +++ b/THANKS @@ -48,6 +48,7 @@ Elrond Elrond@Wunder-Nett.org Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de Erez Zadok ezk@cs.columbia.edu Eric Magnien emagnien@club-internet.fr +Eric Siegerman erics_97@pobox.com Erick Branderhorst branderh@iaehv.nl Erik Lindahl E.Lindahl@chem.rug.nl François Pinard pinard@iro.umontreal.ca @@ -148,6 +149,7 @@ Peter Mattis petm@scam.XCF.Berkeley.EDU Peter Muir iyhi@yahoo.com Petter Reinholdtsen pere@hungry.com Phil Nelson phil@cs.wwu.edu +Philip Fong pwlfong@users.sourceforge.net Rainer Orth ro@techfak.uni-bielefeld.de Raja R Harinath harinath@cs.umn.edu Ralf Corsepius corsepiu@faw.uni-ulm.de diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index 0490fc8b9..19d3f6256 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -129,7 +129,7 @@ top_distdir = ../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ + @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -175,7 +175,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/lib/Makefile.in b/lib/Makefile.in index 6311a5c6b..9721c4c64 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -255,7 +255,7 @@ top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ + @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -314,7 +314,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index fc4db276f..d2b0ba586 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -137,7 +137,7 @@ top_distdir = ../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ + @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -183,7 +183,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 4fec72aaa..e93da629f 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -62,7 +62,7 @@ endif %?TOPDIR_P% ?DISTDIRS? $(mkinstalldirs) %DISTDIRS% ## ## - @for file in $(DISTFILES); do \ + @list='$(DISTFILES)'; for file in $$list; do \ ## ## Always look for the file in the build directory first. That way ## for something like yacc output we will correctly pick up the latest diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am index 4bbdf307c..59230d3bf 100644 --- a/lib/am/texinfos.am +++ b/lib/am/texinfos.am @@ -226,7 +226,7 @@ maintainer-clean-am: maintainer-clean-aminfo maintainer-clean-aminfo: ## Eww. But how else can we find all the output files from makeinfo? ?!CYGNUS? cd $(srcdir) && \ - for i in $(INFO_DEPS); do \ + list='$(INFO_DEPS)'; for i in $$list; do \ rm -f $$i; \ if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ rm -f $$i-[0-9]*; \ diff --git a/m4/Makefile.in b/m4/Makefile.in index e13113912..324fb5a24 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -158,7 +158,7 @@ top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ + @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -204,7 +204,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -rm -f Makefile $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: diff --git a/tests/Makefile.am b/tests/Makefile.am index 57c335ebe..a80d326d7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -134,6 +134,7 @@ distcommon2.test \ distcommon3.test \ distdir.test \ distname.test \ +dollar.test \ double.test \ dup2.test \ dup3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index d49919e5e..13fc72d96 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -218,6 +218,7 @@ distcommon2.test \ distcommon3.test \ distdir.test \ distname.test \ +dollar.test \ double.test \ dup2.test \ dup3.test \ @@ -567,7 +568,7 @@ top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ + @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ diff --git a/tests/dollar.test b/tests/dollar.test new file mode 100755 index 000000000..80af46886 --- /dev/null +++ b/tests/dollar.test @@ -0,0 +1,30 @@ +#!/bin/sh + +# We should support files with `$' characters in their names. +# Java people need this. +# PR/317, reported by Eric Siegerman and Philip Fong. + +. $srcdir/defs + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am <<'EOF' +mydir = $(prefix)/my +dist_my_DATA = hello$$world + +hello$$world: + touch '$@' + +check-dist: distdir + test -f '$(distdir)/hello$$world' +EOF + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure --prefix `pwd`/inst +$MAKE install +test -f 'inst/my/hello$world' +$MAKE check-dist -- 2.47.2