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

Re: [PATCH 1/4] git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2011, 17:15 UTC
Message-ID
<7v1v09un8y.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1304856659-10672-2-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> Add a git-sh-i18n--envsubst program which is a stripped-down version
> of the GNU envsubst(1) program that comes with GNU gettext for use in
> the eval_gettext() fallback
Ok up to this point.
Show 11 quoted lines
> ... instead of using a clever (but broken)
> printf + eval + printf trick.
>
> In a previous incarnation of the gettext series I implemented the
> eval_gettext() fallback like this:
> ...
> This was clever, but ...
> ... 
> To work around this, and to improve our variable expansion behavior
> (eval has security issues) I've imported a stripped-down version of
> gettext's envsubst(1) program.

I do not think the lengthy history of failed experiments above is worth explaining. If you really want to say something to justify a new helper, I think it is sufficient to just explain that it is unsolvable in shell. I tried that in the first 9-line paragraph in:

  http://thread.gmane.org/gmane.comp.version-control.git/170703/focus=170770

In other words, "we tried X that didn't work and we tried Y that didn't either, we cannot think of any better solution, so we are doing something else" is not a good justificiation for doing that "something else".

"Anything based on shell is an unpractical solution for this and that reasons, so we use this instead" explains that the earlier failures were not because we did not try hard enough. Unlike "tried X and Y but didn't work", dismissing "anything based on shell" as a whole class with clear explanation why it would not work would prevent people from pursuing that dead-end approach. It also avoids giving quibbling people an excuse to argue against importing envsubst implementation saying "you didn't try hard enough".

Show 5 quoted lines
> With it eval_gettext() is implemented
> like this:
> ...
> Reported-by: Johannes Sixt <j.sixt@viscovery.net>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Ok.
Show 15 quoted lines
> diff --git a/Documentation/git-sh-i18n--envsubst.txt b/Documentation/git-sh-i18n--envsubst.txt
> new file mode 100644
> index 0000000..e146a2c
> --- /dev/null
> +++ b/Documentation/git-sh-i18n--envsubst.txt
> @@ -0,0 +1,36 @@
> ...
> +Author
> +------
> +Written by Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> +
> +Documentation
> +--------------
> +Documentation by Ævar Arnfjörð Bjarmason and the git-list
> +<git@vger.kernel.org>.
I do not think we do these individual credits these days in the doc.
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 of 13 in “i18n: Add shell script translation infrastructure”
  1. 0/4 i18n: Add shell script translation infrastructureÆvar Arnfjörð Bjarmason, May 8, 2011
  2. 1/4 git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()Ævar Arnfjörð Bjarmason, May 8, 2011
  3. Junio C HamanoMay 8, 2011
  4. Ævar Arnfjörð BjarmasonMay 8, 2011
  5. Junio C HamanoMay 9, 2011
  6. Ævar Arnfjörð BjarmasonMay 9, 2011
  7. 2/4 git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappersÆvar Arnfjörð Bjarmason, May 8, 2011
  8. 3/4 git-sh-i18n.sh: add GIT_GETTEXT_POISON supportÆvar Arnfjörð Bjarmason, May 8, 2011
  9. 4/4 Makefile: add xgettext target for *.sh filesÆvar Arnfjörð Bjarmason, May 8, 2011
  10. Sverre RabbelierMay 8, 2011
  11. Ævar Arnfjörð BjarmasonMay 8, 2011
  12. Sverre RabbelierMay 8, 2011
  13. Ævar Arnfjörð BjarmasonMay 8, 2011

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.