GNOME Bugzilla – Bug 163689
intltool-extract misbehaves on empty "msgid"s
Last modified: 2005-01-21 02:05:57 UTC
intltool-extract on XML assumes that "message ids" are nonempty, which causes strange behavior in cases like this: <comps> <_name>Normal name</_name> <_name></_name> <_name>Other name</_name> </comps> This would result in finding two msgids, "Normal name" and "</_name>\n<_name>Other name". The attached patch (against current CVS as of Jan 11 2005) allows empty msgids for XML, like when processing other file types. This does no harm because such strings are not written out to the .h file anyway. There were no testsuite regressions with this patch.
Created attachment 35835 [details] [review] Allow empty msgids in XML
Miloslav, thanks for the patch. Though, I plan to switch intltool-extract over to XML::Parser as well, so this will be automatically fixed (see bug #160262). What would be nice is adding a test case for this behaviour, so we don't introduce regressions later on. Care to handle that one? :) As for the problem, where did you come across this?
Created attachment 35860 [details] [review] Add a test case for empty msgids in XML This should be enough. Apparently the code for attributes handles empty msgids correctly (by ignoring them), I never tested that before. In real life this happened in practice in Fedora comps (package groups), https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=143751
I've committed both of these patches with appropriate crediting in the ChangeLog to Miloslav. The patches look good, and the test case works properly. It shouldn't be much of an issue to update the patch for converting to XML::Parser for this change, since the 2 lines are being removed in it anyway. :)