Subject: bin/32650: gettext msgXXX command parsing of \x sequences in strings.
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <obata@lins.jp>
List: netbsd-bugs
Date: 01/27/2006 12:10:00
>Number:         32650
>Category:       bin
>Synopsis:       gettext msgXXX command parsing problem of \x sequences in strngs.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 27 12:10:00 +0000 2006
>Originator:     OBATA Akio
>Release:        NetBSD 3.0.0_STABLE
>Organization:
	LINS, Japan.
>Environment:
System: NetBSD miki.lins.jp 3.0.0_STABLE NetBSD 3.0.0_STABLE (MIKI) #8: Wed Jan 11 02:28:09 JST 2006 root@:/usr/src/sys/arch/i386/compile/MIKI i386
Architecture: i386
Machine: i386
>Description:
	"msgcmp", "msgfmt", "msgmsrge", "xgettext", "msgcomm" commands
	in gettext 0.10.35 have parsing problem of \x sequences in strings.

>How-To-Repeat:
	sample file: xx1.po
	======================================================================
	msgid "OK"
	msgstr "OKOKOK\x31"
	======================================================================
	% msgfmt xx1.po
	xx.po:3: end-of-line within string
	found 1 fatal errors
	======================================================================
	Error occured.
	
	sample file: xx2.po
	======================================================================
	msgid "OK"
	msgstr "\x31OKOKOK"
	======================================================================
	% msgfmt xx2.po
	% strings messages
 	1KOKOK
	======================================================================
	No error occured.
	But subsequence character of \x sequences has been lost.
>Fix:
	Here is a patch to fix.
	See Also: http://cvs.savannah.gnu.org/viewcvs/gettext/src/Attic/po-lex.c?root=gettext&r1=1.1&r2=1.2

Index: src/gnu/dist/gettext/src/po-lex.c
===================================================================
RCS file: /home/cvsroot/NetBSD/src/gnu/dist/gettext/src/Attic/po-lex.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 po-lex.c
--- src/gnu/dist/gettext/src/po-lex.c	31 Oct 2000 14:47:32 -0000	1.1.1.1
+++ src/gnu/dist/gettext/src/po-lex.c	27 Jan 2006 11:23:00 -0000
@@ -327,6 +327,7 @@
 	    }
 	  break;
 	}
+      lex_ungetc (c);
       return val;
     }
   po_gram_error (_("illegal control sequence"));