diff options
author | Bruno Haible <bruno@clisp.org> | 2010-05-24 04:05:32 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2010-06-03 15:03:47 +0200 |
commit | 73c7003e8aa94722123bf8d49e25e314f42d61a1 (patch) | |
tree | 9d089181baa38304815455d8c54913543eb7297c | |
parent | c5f32102699222e73e4019c9ce2ba55cbf08767f (diff) | |
download | external_gettext-73c7003e8aa94722123bf8d49e25e314f42d61a1.zip external_gettext-73c7003e8aa94722123bf8d49e25e314f42d61a1.tar.gz external_gettext-73c7003e8aa94722123bf8d49e25e314f42d61a1.tar.bz2 |
msggrep: Fix interpretation of '$' in regular expressions.
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | gettext-tools/libgrep/ChangeLog | 7 | ||||
-rw-r--r-- | gettext-tools/libgrep/m-regex.c | 4 | ||||
-rw-r--r-- | gettext-tools/tests/ChangeLog | 8 | ||||
-rw-r--r-- | gettext-tools/tests/Makefile.am | 2 | ||||
-rwxr-xr-x | gettext-tools/tests/msggrep-10 | 16 | ||||
-rwxr-xr-x | gettext-tools/tests/msggrep-9 | 230 |
7 files changed, 269 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Version 0.18.1 - June 2010 + +* msggrep: A '$' anchor in a regular expression now also matches the end of + the string, even if it does not end in a newline. + Version 0.18 - May 2010 * Runtime behaviour: diff --git a/gettext-tools/libgrep/ChangeLog b/gettext-tools/libgrep/ChangeLog index 1409a7e..f82dd4e 100644 --- a/gettext-tools/libgrep/ChangeLog +++ b/gettext-tools/libgrep/ChangeLog @@ -1,3 +1,10 @@ +2010-05-23 Bruno Haible <bruno@clisp.org> + + msggrep: Fix interpretation of '$' in regular expressions. + * m-regex.c (EGexecute): When searching up to the end of a string that + does not end in a newline, set not_eol to 0. + Reported by Sean Flanigan <sflaniga@redhat.com>. + 2010-05-24 Bruno Haible <bruno@clisp.org> * m-fgrep.c: Untabify. diff --git a/gettext-tools/libgrep/m-regex.c b/gettext-tools/libgrep/m-regex.c index 8af10df..0c5b584 100644 --- a/gettext-tools/libgrep/m-regex.c +++ b/gettext-tools/libgrep/m-regex.c @@ -161,7 +161,7 @@ EGexecute (const void *compiled_pattern, for (i = 0; i < cregex->pcount; i++) { - cregex->patterns[i].regexbuf.not_eol = (end == buflim); + cregex->patterns[i].regexbuf.not_eol = 0; if (0 <= (start = re_search (&(cregex->patterns[i].regexbuf), beg, end - beg, 0, end - beg, &(cregex->patterns[i].regs)))) @@ -204,7 +204,7 @@ EGexecute (const void *compiled_pattern, if (start == end - beg) break; ++start; - cregex->patterns[i].regexbuf.not_eol = (end == buflim); + cregex->patterns[i].regexbuf.not_eol = 0; start = re_search (&(cregex->patterns[i].regexbuf), beg, end - beg, start, end - beg - start, diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index e0546e1..71df3d2 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,11 @@ +2010-05-23 Bruno Haible <bruno@clisp.org> + + msggrep: Fix interpretation of '$' in regular expressions. + * msggrep-9: New file. + * msggrep-10: New file. + * Makefile.am (TESTS): Add them. + Reported by Sean Flanigan <sflaniga@redhat.com>. + 2010-05-22 Bruno Haible <bruno@clisp.org> xgettext-glade-4: Skip, not fail, when expat was not available. diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index 496e13e..4855a99 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -49,7 +49,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \ msgfmt-properties-1 \ msgfmt-qt-1 msgfmt-qt-2 \ msggrep-1 msggrep-2 msggrep-3 msggrep-4 msggrep-5 msggrep-6 msggrep-7 \ - msggrep-8 \ + msggrep-8 msggrep-9 msggrep-10 \ msginit-1 msginit-2 \ msgmerge-1 msgmerge-2 msgmerge-3 msgmerge-4 msgmerge-5 msgmerge-6 \ msgmerge-7 msgmerge-8 msgmerge-9 msgmerge-10 msgmerge-11 msgmerge-12 \ diff --git a/gettext-tools/tests/msggrep-10 b/gettext-tools/tests/msggrep-10 new file mode 100755 index 0000000..9ca91c2 --- /dev/null +++ b/gettext-tools/tests/msggrep-10 @@ -0,0 +1,16 @@ +#! /bin/sh + +# Verify that $ as end-of-line anchor does not cause a crash. +# <https://bugzilla.redhat.com/show_bug.cgi?id=483181> +# <https://savannah.gnu.org/bugs/?25437> + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +: ${MSGGREP=msggrep} +echo a=b | LC_MESSAGES=C LC_ALL= ${MSGGREP} -P -K -e '^a$' > /dev/null +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/msggrep-9 b/gettext-tools/tests/msggrep-9 new file mode 100755 index 0000000..8ededc2 --- /dev/null +++ b/gettext-tools/tests/msggrep-9 @@ -0,0 +1,230 @@ +#! /bin/sh + +# Test interpretation of $ as end-of-line anchor. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles mg-test9.po" +cat <<\EOF > mg-test9.po +# German translations for GNU gettext package. +# Copyright (C) 1995, 1996, 1997, 2001 Free Software Foundation, Inc. +msgid "" +msgstr "" +"Project-Id-Version: GNU gettext 0.11-pre1\n" +"POT-Creation-Date: 2001-12-08 20:33+0100\n" +"PO-Revision-Date: 2001-11-04 12:25+0100\n" +"Last-Translator: Karl Eichwalder <ke@suse.de>\n" +"Language-Team: German <de@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: argmatch.c:141 +msgid "invalid argument" +msgstr "ungültiges Argument" + +#: argmatch.c:142 +msgid "ambiguous argument" +msgstr "mehrdeutiges Argument" + +#: argmatch.c:162 +msgid "Valid arguments are:" +msgstr "Gültige Argumente sind:" + +#: copy-file.c:60 +#, c-format +msgid "error while opening \"%s\" for reading" +msgstr "Öffnen der Datei »%s« zum Lesen fehlgeschlagen" + +#: copy-file.c:67 +#, c-format +msgid "cannot open backup file \"%s\" for writing" +msgstr "Öffnen der Sicherungsdatei »%s« zum Schreiben fehlgeschlagen" + +#: copy-file.c:80 +#, c-format +msgid "error reading \"%s\"" +msgstr "Fehler beim Lesen von »%s«" + +#: copy-file.c:86 copy-file.c:90 +#, c-format +msgid "error writing \"%s\"" +msgstr "Fehler beim Schreiben von »%s«" + +#: copy-file.c:92 +#, c-format +msgid "error after reading \"%s\"" +msgstr "Fehler nach dem Lesen von »%s«" + +#: error.c:115 +msgid "Unknown system error" +msgstr "Unbekannter Systemfehler" + +#: execute.c:170 execute.c:205 pipe-bidi.c:156 pipe-bidi.c:191 pipe-in.c:169 +#: pipe-in.c:205 pipe-out.c:169 pipe-out.c:205 wait-process.c:136 +#, c-format +msgid "%s subprocess failed" +msgstr "Subprozess %s fehlgeschlagen" + +#: getopt.c:691 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: Option »%s« ist mehrdeutig\n" + +#: getopt.c:716 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: Option »--%s« erwartet kein Argument\n" + +#: getopt.c:721 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: Option »%c%s« erwartet kein Argument\n" + +#: getopt.c:739 getopt.c:912 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: Option »%s« erwartet ein Argument\n" + +#: getopt.c:768 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: unbekannte Option »--%s«\n" + +#: getopt.c:772 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: unbekannte Option »%c%s«\n" + +#: getopt.c:798 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: unzulässige Option -- %c\n" + +#: getopt.c:801 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ungültige Option -- %c\n" + +#: getopt.c:831 getopt.c:961 +#, c-format +msgid "" +"%s: option requires an argument\n" +"--> %c\n" +msgstr "" +"%s: Option erwartet ein Argument\n" +"--> %c\n" + +#: getopt.c:878 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: Option »-W %s« ist mehrdeutig\n" + +#: getopt.c:896 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: Option »-W %s« erwartet kein Argument\n" + +#: javacomp.c:465 +msgid "Java compiler not found, try installing gcj or set $JAVAC" +msgstr "" +"Java-Compiler nicht gefunden; bitte »gcj« installieren oder $JAVAC setzen" + +#: javaexec.c:404 +msgid "Java virtual machine not found, try installing gij or set $JAVA" +msgstr "" +"Virtuelle Java-Maschine nicht gefunden; bitte »gcj« installieren oder\n" +"$JAVA setzen" + +#: obstack.c:474 xerror.c:75 xmalloc.c:56 +msgid "memory exhausted" +msgstr "virtueller Speicher erschöpft" + +#: pipe-bidi.c:119 pipe-bidi.c:121 pipe-in.c:136 pipe-out.c:136 +msgid "cannot create pipe" +msgstr "Es ist nicht möglich, eine Pipe zu erzeugen" + +#: wait-process.c:117 +#, c-format +msgid "%s subprocess" +msgstr "Subprozess %s" + +#: wait-process.c:129 +#, c-format +msgid "%s subprocess got fatal signal" +msgstr "Subprozess %s hat ein fatales Signal erhalten" +EOF + +tmpfiles="$tmpfiles mg-test9.tmp mg-test9.err mg-test9.out" +: ${MSGGREP=msggrep} +LC_MESSAGES=C LC_ALL= \ +${MSGGREP} -K -e 'argument$' -o mg-test9.tmp mg-test9.po > mg-test9.err 2>&1 +result=$? +cat mg-test9.err | grep -v 'warning: Locale charset' | grep -v '^ ' +test $result = 0 || { rm -fr $tmpfiles; exit 1; } +LC_ALL=C tr -d '\r' < mg-test9.tmp > mg-test9.out +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles mg-test9.ok" +cat <<\EOF > mg-test9.ok +# German translations for GNU gettext package. +# Copyright (C) 1995, 1996, 1997, 2001 Free Software Foundation, Inc. +msgid "" +msgstr "" +"Project-Id-Version: GNU gettext 0.11-pre1\n" +"POT-Creation-Date: 2001-12-08 20:33+0100\n" +"PO-Revision-Date: 2001-11-04 12:25+0100\n" +"Last-Translator: Karl Eichwalder <ke@suse.de>\n" +"Language-Team: German <de@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: argmatch.c:141 +msgid "invalid argument" +msgstr "ungültiges Argument" + +#: argmatch.c:142 +msgid "ambiguous argument" +msgstr "mehrdeutiges Argument" + +#: getopt.c:716 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: Option »--%s« erwartet kein Argument\n" + +#: getopt.c:721 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: Option »%c%s« erwartet kein Argument\n" + +#: getopt.c:739 getopt.c:912 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: Option »%s« erwartet ein Argument\n" + +#: getopt.c:831 getopt.c:961 +#, c-format +msgid "" +"%s: option requires an argument\n" +"--> %c\n" +msgstr "" +"%s: Option erwartet ein Argument\n" +"--> %c\n" + +#: getopt.c:896 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: Option »-W %s« erwartet kein Argument\n" +EOF + +: ${DIFF=diff} +${DIFF} mg-test9.ok mg-test9.out +result=$? + +rm -fr $tmpfiles + +exit $result |