Re: [PATCH 09/11] GETTEXT_POISON=rot13: do compare the output in `test_i18ncmp`
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 15, 2021, 15:44 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2101151643410.52@tvgsbejvaqbjf.bet>
- In-Reply-To
- <xmqqeeiq3pkf.fsf@gitster.c.googlers.com>
Hi Junio,
On Tue, 12 Jan 2021, Junio C Hamano wrote:
Show 15 quoted lines
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > +static size_t unrot13(char *buf)
> > +{
> > + char *p = buf, *q = buf;
> > +
> > + while (*p) {
> > + const char *begin = strstr(p, "<rot13>"), *end;
>
> AFAIR from my reading of [02/11], the encoding side did not special
> case the payload that has <ebg13> or </ebg13>; if we want to make it
> reversible conversion (which is excellent improvement over the
> current "# GETTEXT_POISON #" obfuscation), we'd need to do something
> about it, I think.Do you expect any message to be translated _twice_?
Ciao, Dscho
Show 29 quoted lines
> But on second thought, nobody can prevent a caller to die(_("%s", msg));
> to have "<rot13>" in the msg part, so perhaps punting like this
> series does is sufficient. I dunno.
>
> > + if (!begin)
> > + break;
> > +
> > + while (p != begin)
> > + *(q++) = *(p++);
> > +
> > + p += strlen("<rot13>");
> > + end = strstr(p, "</rot13>");
> > + if (!end)
> > + BUG("could not find </rot13> in\n%s", buf);
>
> And the user of this looks quite straightforward and nice.
>
> > test_i18ncmp () {
> > - ! test_have_prereq C_LOCALE_OUTPUT || test_cmp "$@"
> > + if test rot13 = "$GIT_TEST_GETTEXT_POISON"
> > + then
> > + test-tool i18n cmp "$@"
> > + elif test_have_prereq C_LOCALE_OUTPUT
> > + then
> > + test_cmp "$@"
> > + fi
> > }
>
>