diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | libidu/scanners.c | 4 | ||||
-rw-r--r-- | testsuite/Makefile.am | 7 | ||||
-rwxr-xr-x | testsuite/infloop-kawa-el | 58 |
4 files changed, 77 insertions, 3 deletions
@@ -1,3 +1,14 @@ +2007-01-19 Jim Meyering <jim@meyering.net> + + Temporary fix simply to avoid the infloop. + * libidu/scanners.c (get_token_lisp): Disable the code that + treats '[]' as part of a kawa identifier. It could call ungetc + two or three times in a row. One is the maximum. + * testsuite/infloop-kawa-el: New file. Test for the above. + * testsuite/Makefile.am (TESTS): Add infloop-kawa-el. + (TESTS_ENVIRONMENT): Prepend build directory to PATH so that + invoking e.g., "mkid" runs the just-built version of the tool. + 2006-11-25 Claudio Fontana <claudio@gnu.org> * libidu/scanners.c (get_token_lisp): provide rough support for diff --git a/libidu/scanners.c b/libidu/scanners.c index 112fd43..6a302bf 100644 --- a/libidu/scanners.c +++ b/libidu/scanners.c @@ -1,5 +1,5 @@ /* scanners.c -- file & directory name manipulations - Copyright (C) 1986, 1995, 1996, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1986, 1995, 1996, 1999, 2000, 2007 Free Software Foundation, Inc. Written by Greg McGary <gkm@gnu.ai.mit.edu> This program is free software; you can redistribute it and/or modify @@ -1749,7 +1749,7 @@ get_token_lisp (FILE *in_FILE, void const *args, int *flags) { while (is_IDENT (c = getc (in_FILE))) *id++ = c; - if (c == '[') + if (0 /* c == '[' */) { c = getc (in_FILE); if (c == ']') diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index b932992..cce9c0f 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -1,6 +1,11 @@ ## Process this file with automake to create Makefile.in -TESTS = consistency +TESTS = \ + consistency \ + infloop-kawa-el + +TESTS_ENVIRONMENT = \ + PATH="$(abs_builddir)/../src$(PATH_SEPARATOR)$$PATH" EXTRA_DIST = $(TESTS) single_file_token_bug.c diff --git a/testsuite/infloop-kawa-el b/testsuite/infloop-kawa-el new file mode 100755 index 0000000..7849e16 --- /dev/null +++ b/testsuite/infloop-kawa-el @@ -0,0 +1,58 @@ +#!/bin/sh +# This would provoke an infloop with source from 4.2+ (cvs as of 2007-01-19). + +# Copyright (C) 2007 Free Software Foundation, Inc. + +# This program 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 of the License, or +# (at your option) any later version. + +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +if test "$VERBOSE" = yes; then + set -x + mkid --version +fi + +pwd=`pwd` +t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$ +trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0 +trap '(exit $?); exit $?' 1 2 13 15 + +framework_failure=0 +mkdir -p $tmp || framework_failure=1 +cd $tmp || framework_failure=1 +echo 'boo[! bar[]' > f.el || framework_failure=1 + +# FIXME: The expected output should probably be these two lines: +# bar +# boo[] +# but the code to handle that (now-disabled) did a double-ungetc. +cat <<EOF > exp || framework_failure=1 # expect no output +bar +boo +EOF + +if test $framework_failure = 1; then + echo "$0: failure in testing framework" 1>&2 + (exit 1); exit 1 +fi + +fail=0 + +mkid f.el > out || fail=1 +aid -R none b >> out || fail=1 + +cmp out exp || fail=1 +test $fail = 1 && diff out exp 2> /dev/null + +(exit $fail); exit $fail |