From 2d4d4f9a58273a3e2df6a92977e89aae12d12392 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 6 Apr 2008 09:20:36 +0000 Subject: Avoid possible error when 'tr' gets fed random bytes in an UTF-8 locale. --- ChangeLog | 4 ++++ tests/Makefile.in | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc484bc..4867dc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-06 Bruno Haible + + * tests/Makefile.in: Use "LC_ALL=C tr" instead of "tr". + 2007-09-08 Bruno Haible Change generated code to avoid a warning by GCC 4.2 that the meaning diff --git a/tests/Makefile.in b/tests/Makefile.in index 1f1b317..163ac69 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,6 +1,6 @@ # Makefile for gperf/tests -# Copyright (C) 1989, 1992-1993, 1995, 1998, 2000, 2002-2004, 2007 Free Software Foundation, Inc. +# Copyright (C) 1989, 1992-1993, 1995, 1998, 2000, 2002-2004, 2007-2008 Free Software Foundation, Inc. # Written by Douglas C. Schmidt # and Bruno Haible . # @@ -74,7 +74,7 @@ check-link-c++: force check-c: @echo "testing ANSI C reserved words, all items should be found in the set" - ./cout -v < $(srcdir)/c.gperf | tr -d '\r' > c.out + ./cout -v < $(srcdir)/c.gperf | LC_ALL=C tr -d '\r' > c.out diff $(srcdir)/c.exp c.out check-ada: @@ -82,26 +82,26 @@ check-ada: # double '$$' is only there since make gets confused; program wants only 1 '$' $(CC) $(CFLAGS) -o aout adainset.c test.o @echo "testing Ada reserved words, all items should be found in the set" - ./aout -v < $(srcdir)/ada.gperf | tr -d '\r' > ada-res.out + ./aout -v < $(srcdir)/ada.gperf | LC_ALL=C tr -d '\r' > ada-res.out diff $(srcdir)/ada-res.exp ada-res.out $(GPERF) -D -k1,'$$' -s 2 -I -o $(srcdir)/adadefs.gperf > preinset.c $(CC) $(CFLAGS) -o preout preinset.c test.o @echo "testing Ada predefined words, all items should be found in the set" - ./preout -v < $(srcdir)/adadefs.gperf | tr -d '\r' > ada-pred.out + ./preout -v < $(srcdir)/adadefs.gperf | LC_ALL=C tr -d '\r' > ada-pred.out diff $(srcdir)/ada-pred.exp ada-pred.out check-modula3: $(GPERF) -k1,2,'$$' -I -o $(srcdir)/modula3.gperf > m3inset.c $(CC) $(CFLAGS) -o m3out m3inset.c test.o @echo "testing Modula3 reserved words, all items should be found in the set" - ./m3out -v < $(srcdir)/modula3.gperf | tr -d '\r' > modula.out + ./m3out -v < $(srcdir)/modula3.gperf | LC_ALL=C tr -d '\r' > modula.out diff $(srcdir)/modula.exp modula.out check-pascal: $(GPERF) -o -S2 -I < $(srcdir)/pascal.gperf > pinset.c $(CC) $(CFLAGS) -o pout pinset.c test.o @echo "testing Pascal reserved words, all items should be found in the set" - ./pout -v < $(srcdir)/pascal.gperf | tr -d '\r' > pascal.out + ./pout -v < $(srcdir)/pascal.gperf | LC_ALL=C tr -d '\r' > pascal.out diff $(srcdir)/pascal.exp pascal.out # check for 8-bit cleanliness @@ -109,7 +109,7 @@ check-lang-utf8: $(GPERF) -k1 -t -I -K foreign_name < $(srcdir)/lang-utf8.gperf > lu8inset.c $(CC) $(CFLAGS) -o lu8out lu8inset.c test.o @echo "testing UTF-8 encoded languages, all items should be found in the set" - sed -e '1,6d' -e 's/,.*//' < $(srcdir)/lang-utf8.gperf | ./lu8out -v | tr -d '\r' > lang-utf8.out + sed -e '1,6d' -e 's/,.*//' < $(srcdir)/lang-utf8.gperf | ./lu8out -v | LC_ALL=C tr -d '\r' > lang-utf8.out diff $(srcdir)/lang-utf8.exp lang-utf8.out # check for binary keywords with NUL bytes @@ -118,7 +118,7 @@ check-lang-ucs2: $(GPERF) -k4 -t -l -I -K foreign_name < $(srcdir)/lang-ucs2.gperf > lu2inset.c $(CC) $(CFLAGS) -o lu2out lu2inset.c test2.o @echo "testing UCS-2 encoded languages, all items should be found in the set" - ./lu2out -v < $(srcdir)/lang-ucs2.in | tr -d '\r' > lang-ucs2.out + ./lu2out -v < $(srcdir)/lang-ucs2.in | LC_ALL=C tr -d '\r' > lang-ucs2.out diff $(srcdir)/lang-ucs2.exp lang-ucs2.out # check case-insensitive lookup @@ -135,7 +135,7 @@ check-smtp: ./smtp # these next 5 are demos that show off the generated code -POSTPROCESS_FOR_MINGW = tr -d '\r' | sed -e 's|[^ ]*[/\\][\\]*src[/\\][\\]*gperf[^ ]*|../src/gperf|' +POSTPROCESS_FOR_MINGW = LC_ALL=C tr -d '\r' | sed -e 's|[^ ]*[/\\][\\]*src[/\\][\\]*gperf[^ ]*|../src/gperf|' check-test: $(GPERF) -L C -F ', 0, 0' -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,'$$' < $(srcdir)/c-parse.gperf | $(POSTPROCESS_FOR_MINGW) > c-parse.out diff $(srcdir)/c-parse.exp c-parse.out -- cgit v1.2.1