This is the mail archive of the
automake-prs@sourceware.org
mailing list for the automake project.
Re: automake/483: "missing" doesn't handle "--output" for missing makeinfo
- From: Ralf Wildenhues <Ralf dot Wildenhues at gmx dot de>
- To: adl at sources dot redhat dot com
- Cc: automake-prs at sources dot redhat dot com,
- Date: 22 Apr 2006 12:11:01 -0000
- Subject: Re: automake/483: "missing" doesn't handle "--output" for missing makeinfo
- Reply-to: Ralf Wildenhues <Ralf dot Wildenhues at gmx dot de>
The following reply was made to PR automake/483; it has been noted by GNATS.
From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
To: Dennis.J.Linse@SAIC.com, automake-gnats@sources.redhat.com,
automake-patches@gnu.org
Cc:
Subject: Re: automake/483: "missing" doesn't handle "--output" for missing makeinfo
Date: Sat, 22 Apr 2006 14:00:56 +0200
--KFztAG8eRSV9hGtP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=automake&pr=483
Hi Dennis,
Sorry for the long delay, and thanks for the bug report.
Looking at the `missing' script, there are a couple more issues:
- the sed scripts for matching `-o' and `--output' aren't all the
same; furthermore, they are less strict than they could be: we
can know for sure both flags will be preceded by a space, and
there will be exactly one space or equal sign between `--output'
and its argument (all due to how we echo the args before);
- autom4te isn't documented in --help output.
So then I got adventurous and wrote another one of those testsuite
tests that are supposed to entertain the reader. ;-)
(I'll leave it as an exercise to find out why I removed usage of `['
from `missing'.)
OK to apply both attached patches?
Cheers,
Ralf
* lib/missing (sed_minuso, sed_output): New variables.
(autom4te, help2man, makeinfo): Use them. Unifies detection of
`-o FILE', `--output FILE', `--output=FILE', stricter regex.
Fixes `missing' to detect `--output' for help2man (PR 483).
Report by Dennis J. Linse <Dennis.J.Linse@SAIC.com>.
(autom4te): Document in `missing --help'.
* THANKS: Update.
* lib/missing: Remove superfluous quotes. Replace all uses of
`[' by `test', for consistency, and for..
* tests/missing4.test: ..this new test.
* tests/Makefile.am: Update.
--KFztAG8eRSV9hGtP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="missing-output.diff"
* lib/missing (sed_minuso, sed_output): New variables.
(autom4te, help2man, makeinfo): Use them. Unifies detection of
`-o FILE', `--output FILE', `--output=FILE', stricter regex.
Fixes `missing' to detect `--output' for help2man (PR 483).
Report by Dennis J. Linse <Dennis.J.Linse@SAIC.com>.
(autom4te): Document in `missing --help'.
* THANKS: Update.
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.281
diff -u -r1.281 THANKS
--- THANKS 20 Apr 2006 16:24:15 -0000 1.281
+++ THANKS 22 Apr 2006 11:37:55 -0000
@@ -52,6 +52,7 @@
David Pashley david@davidpashley.com
David Zaroski cz253@cleveland.Freenet.Edu
Dean Povey dpovey@wedgetail.com
+Dennis J. Linse Dennis.J.Linse@SAIC.com
Derek R. Price derek.price@openavenue.com
Diab Jerius djerius@cfa.harvard.edu
Didier Cassirame faded@free.fr
Index: lib/missing
===================================================================
RCS file: /cvs/automake/automake/lib/missing,v
retrieving revision 1.30
diff -u -r1.30 missing
--- lib/missing 12 Jan 2006 21:11:14 -0000 1.30
+++ lib/missing 22 Apr 2006 11:25:33 -0000
@@ -1,7 +1,7 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2006-01-12.21
+scriptversion=2006-04-22.14
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
@@ -33,6 +33,8 @@
fi
run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
@@ -77,6 +79,7 @@
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
@@ -192,8 +195,8 @@
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
- file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
- test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
@@ -267,11 +270,9 @@
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
- fi
- if [ -f "$file" ]; then
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
@@ -289,7 +290,8 @@
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
--KFztAG8eRSV9hGtP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="missing-test-quotes.diff"
* lib/missing: Remove superfluous quotes. Replace all uses of
`[' by `test', for consistency, and for..
* tests/missing4.test: ..this new test.
* tests/Makefile.am: Update.
Index: lib/missing
===================================================================
RCS file: /cvs/automake/automake/lib/missing,v
retrieving revision 1.30
diff -u -r1.30 missing
--- lib/missing 12 Jan 2006 21:11:14 -0000 1.30
+++ lib/missing 22 Apr 2006 11:25:33 -0000
@@ -44,7 +46,7 @@
msg="missing on your system"
-case "$1" in
+case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
@@ -106,7 +109,7 @@
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
-case "$1" in
+case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
@@ -135,7 +138,7 @@
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case "$1" in
+case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -164,7 +167,7 @@
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
- case "$f" in
+ case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
@@ -214,25 +217,25 @@
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
- if [ $# -ne 1 ]; then
+ if test $# -ne 1; then
eval LASTARG="\${$#}"
- case "$LASTARG" in
+ case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
- if [ ! -f y.tab.h ]; then
+ if test ! -f y.tab.h; then
echo >y.tab.h
fi
- if [ ! -f y.tab.c ]; then
+ if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
@@ -244,18 +247,18 @@
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
- if [ $# -ne 1 ]; then
+ if test $# -ne 1; then
eval LASTARG="\${$#}"
- case "$LASTARG" in
+ case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if [ -f "$SRCFILE" ]; then
+ if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
- if [ ! -f lex.yy.c ]; then
+ if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
@@ -322,13 +324,13 @@
fi
firstarg="$1"
if shift; then
- case "$firstarg" in
+ case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
- case "$firstarg" in
+ case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.602
diff -u -r1.602 Makefile.am
--- tests/Makefile.am 19 Apr 2006 16:41:32 -0000 1.602
+++ tests/Makefile.am 22 Apr 2006 11:43:36 -0000
@@ -357,6 +357,7 @@
missing.test \
missing2.test \
missing3.test \
+missing4.test \
mkinstall.test \
mkinst2.test \
mkinst3.test \
--- /dev/null 2006-04-22 14:16:50.823007744 +0200
+++ tests/missing4.test 2006-04-22 13:51:28.000000000 +0200
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# test how well `missing' finds output file names of various tools.
+# PR automake/483.
+
+. ./defs || exit 1
+
+set -e
+
+# these programs may be invoked by `missing'
+needed_tools='chmod find sed test touch'
+needed_tools_csep=`echo $needed_tools | sed 's/ /, /g'`
+
+cat >configure.in <<EOF
+AC_INIT([missing4], [1.0])
+m4_foreach([tool], [$needed_tools_csep],
+ [AC_PATH_PROG(tool, tool, [false])
+ AC_CONFIG_FILES(tool, chmod +x tool)
+ ])
+AC_OUTPUT
+EOF
+
+for tool in $needed_tools; do
+ cat >$tool.in <<EOF
+#! /bin/sh
+exec @$tool@ "\$@"
+EOF
+done
+
+$AUTOCONF
+./configure
+
+echo output-file > output-file
+cp output-file my--output--file-o
+
+save_PATH=$PATH
+PATH=.
+export PATH
+missing --help
+missing --version
+for tool in autom4te help2man makeinfo; do
+ missing --run $tool -o my--output--file-o input
+ missing --run $tool --output my--output--file-o input
+done
+PATH=$save_PATH
+export PATH
+diff output-file my--output--file-o
+test ! -f ./--file-o
+test ! -f input
--KFztAG8eRSV9hGtP--