git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 09/11] GETTEXT_POISON=rot13: do compare the output in `test_i18ncmp`

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 18, 2021, 14:36 UTC
Message-ID
<nycvar.QRO.7.76.6.2101181526550.52@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqlfcurn05.fsf@gitster.c.googlers.com>
Hi Junio,
On Fri, 15 Jan 2021, Junio C Hamano wrote:
Show 30 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Tue, 12 Jan 2021, Junio C Hamano wrote:
> >
> >> > +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_?
>
> Not at all.
>
> But what I had in mind, when I wrote the above, was that the
> programmers are entitled to expect that they are allowed to say:
>
> 	die(_("message with <ebg13/>, <ebg13> and <rot13> in it"));
>
> This will be rot13'd, and the entire thing will be enclosed inside
> "<rot13>...</rot13>"; I would expect that somewhere inside "..." the
> receiving end that attempts to parse it by relying on these markers
> will be confused.
Oh, _that_ is what you meant.
Yep, I don't expect any of Git's messages to contain "<ebg13>", ever.
Show 5 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.
>
> And this comment still stands.

Slightly pedantic: the call would be `die(_("%s"), msg)` (note that the `msg` is not inside the `_(...)`).

Similar to my point above, I do not expect any of Git's tests to emit a message like that, and certainly not once/if we turn on rot13 mode in the GETTEXT_POISON job of the CI build.

A blocker would have been if there might be the possibility that we _must_ add a test in the future that wants to emit a `msg` containing `<rot13>`. But that seems utterly unlikely. And even if: then we'd just change the rot13 mode to use a different needle.

Ciao, Dscho

Previous: Junio C HamanoNext: Johannes Schindelin via GitGitGadget
Message 16 of 31 in “[RFH] Introduce support for GETTEXT_POISON=rot13”
  1. 00/11 [RFH] Introduce support for GETTEXT_POISON=rot13Johannes Schindelin via GitGitGadget, Jan 12, 2021
  2. 03/11 parse-options: add forgotten translationsJohannes Schindelin via GitGitGadget, Jan 12, 2021
  3. 02/11 Support GIT_TEST_GETTEXT_POISON=rot13Johannes Schindelin via GitGitGadget, Jan 12, 2021
  4. Junio C HamanoJan 12, 2021
  5. 01/11 tests: remove unnecessary GIT_TEST_GETTEXT_POISON=false constructsJohannes Schindelin via GitGitGadget, Jan 12, 2021
  6. SZEDER GáborJan 12, 2021
  7. 06/11 t0041: stop using `test_i18ngrep` on untranslated outputJohannes Schindelin via GitGitGadget, Jan 12, 2021
  8. 05/11 t0006: use `test_i18ncmp` only for C localesJohannes Schindelin via GitGitGadget, Jan 12, 2021
  9. 07/11 t0027: mark a function as requiring the C localeJohannes Schindelin via GitGitGadget, Jan 12, 2021
  10. 08/11 t6301: do not expect the output of `for-each-ref` to be translatedJohannes Schindelin via GitGitGadget, Jan 12, 2021
  11. 10/11 GETTEXT_POISON=rot13: perform actual checks in `test_i18ngrep`Johannes Schindelin via GitGitGadget, Jan 12, 2021
  12. 09/11 GETTEXT_POISON=rot13: do compare the output in `test_i18ncmp`Johannes Schindelin via GitGitGadget, Jan 12, 2021
  13. Junio C HamanoJan 12, 2021
  14. Johannes SchindelinJan 15, 2021
  15. Junio C HamanoJan 15, 2021
  16. Johannes SchindelinJan 18, 2021
  17. 11/11 test-tool i18n: do not complain about empty messagesJohannes Schindelin via GitGitGadget, Jan 12, 2021
  18. 04/11 sha1dc: mark forgotten message for translationJohannes Schindelin via GitGitGadget, Jan 12, 2021
  19. Jeff KingJan 12, 2021
  20. Junio C HamanoJan 12, 2021
  21. Johannes SchindelinJan 15, 2021
  22. Jeff KingJan 15, 2021
  23. Johannes SchindelinJan 18, 2021
  24. Junio C HamanoJan 18, 2021
  25. Johannes SchindelinJan 19, 2021
  26. Jeff KingJan 12, 2021
  27. Junio C HamanoJan 12, 2021
  28. Jeff KingJan 13, 2021
  29. Junio C HamanoJan 16, 2021
  30. Ævar Arnfjörð BjarmasonJan 12, 2021
  31. Johannes SchindelinJan 15, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.