bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug#386912: errors in the Perl parser of xgettext: invalid variable inte


From: Santiago Vila
Subject: Bug#386912: errors in the Perl parser of xgettext: invalid variable interpolation at "$" (fwd)
Date: Mon, 11 Sep 2006 12:57:58 +0200 (CEST)

Hello.

Received this report from the debian bug system. You will love it,
as it includes a patch. Thank you a lot, Nicolas.

---------- Forwarded message ----------
From: "Nicolas François" <address@hidden>
To: Debian Bug Tracking System <address@hidden>
Date: Mon, 11 Sep 2006 02:16:28 +0200
Subject: Bug#386912: errors in the Perl parser of xgettext: invalid variable
    interpolation at "$"

Package: gettext
Version: 0.15-2
Severity: important


Hello,

dpkg currently fails to update its POTs which contain strings extracted
from Perl scripts.

The attached Perl script is a minimal example to reproduce this bug.
It also gives some ideas on how to fix the perl scripts to bypass the bug.

    xgettext -k_ test.pl
    test.pl:10: invalid variable interpolation at "$"

It seems xgettext considers some strings out of _(...) as being part of the
msgid, and thus refuses dollars in the parameters following the format of
printf.

I think the bug is caused by extract_balanced in gettext-tools/src/x-perl.c
This function uses a state and is recusive, but the state is not
propagated back to the caller. I made a test, which uses the following
prototype (state is now a pointer):
static bool extract_balanced (message_list_ty *mlp, int *state,
                              token_type_ty delim,
                              flag_context_ty outer_context,
                              flag_context_list_iterator_ty context_iter,
                              int arg, struct arglist_parser *argparser);

It works with the attached example, but I did not test it on something
more complicated. Also, I was a little bit lost in the parser, so it may
be completely wrong.

Kind Regards,
-- 
Nekral

Attachment: test.pl
Description: Text Data

Attachment: gettext_perl.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]