Re: [PATCH 7/8] gettext: introduce GIT_GETTEXT_POISON=scrambled

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

 



On Mon, Oct 22, 2018 at 10:23 PM SZEDER Gábor <szeder.dev@xxxxxxxxx> wrote:
> [TODO: Fallout?
>        A 'printf(_("foo: %s"), var);' call includes the contents of
>        'var' unscrambled in the output.  Could that hide the
>        translation of a string that should not have been translated?
>        I'm afraid yes: to check the output of that printf() a sloppy
>        test could do:
>
>          git plumbing-cmd >out && grep "var's content" out
>
>        which would fail in a regular GETTEXT_POISON test run, but
>        would succeed in a scrambled test run.  Does this matter in
>        practice, do we care at all?

If var is supposed to be translated, _() must have been called before
the final string is stored in var and the content is already
scrambled. Whatever left unscrambled is machine-generated and should
be ok to grep, or we have found new strings that should be _() but
not.

PS. Another thing I'd like to have is to mark the beginning and end of
a scrambled text. For example, _("foo") produces "[f.o.o]" or
something like that. If we have it, it's easier to see "text legos"
(instead of full sentences) that makes translator's life harder. But
it could interfere with stuff (e.g. some strings must start with '#')
so let's forget it for now.

>
>        Does gettext_scramble() need a FORMAT_PRESERVING annotation?
>        Seems to work fine without it so far...]

I don't think you can. _() can be called on plain strings that just
happen to have '%' in them.
-- 
Duy




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux