From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH 1/4] git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()
Date: Sun, 8 May 2011 23:33:46 +0200 [thread overview]
Message-ID: <BANLkTikSvU4haNpRmPq8o2P0yB1Y3t0Ahg@mail.gmail.com> (raw)
In-Reply-To: <7v1v09un8y.fsf@alter.siamese.dyndns.org>
On Sun, May 8, 2011 at 19:15, Junio C Hamano <gitster@pobox.com> wrote:
> Æ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.
>
>> ... 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".
I included the failed experiments because I know for sure that those
don't work, but I'm not sure that this is impossible in shell, and it
might be possible in some non-POSIX shell (which we could optionally
take advantage of on certain platforms in the future).
So having the failed examples that we know don't work is valuable for
anyone digging into this in the future.
Or are we sure that this can't work in POSIX (or non-POSIX shells)?
>> 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.
>
>> 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.
I wrote this when that was the convention, but evidently we've changed
that since then.
I'll remove it in the next iteration.
next prev parent reply other threads:[~2011-05-08 21:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-08 12:10 [PATCH 0/4] i18n: Add shell script translation infrastructure Ævar Arnfjörð Bjarmason
2011-05-08 12:10 ` [PATCH 1/4] git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext() Ævar Arnfjörð Bjarmason
2011-05-08 17:15 ` Junio C Hamano
2011-05-08 21:33 ` Ævar Arnfjörð Bjarmason [this message]
2011-05-09 3:17 ` Junio C Hamano
2011-05-09 7:52 ` Ævar Arnfjörð Bjarmason
2011-05-08 12:10 ` [PATCH 2/4] git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers Ævar Arnfjörð Bjarmason
2011-05-08 12:10 ` [PATCH 3/4] git-sh-i18n.sh: add GIT_GETTEXT_POISON support Ævar Arnfjörð Bjarmason
2011-05-08 12:10 ` [PATCH 4/4] Makefile: add xgettext target for *.sh files Ævar Arnfjörð Bjarmason
2011-05-08 17:03 ` [PATCH 0/4] i18n: Add shell script translation infrastructure Sverre Rabbelier
2011-05-08 21:38 ` Ævar Arnfjörð Bjarmason
2011-05-08 21:45 ` Sverre Rabbelier
2011-05-08 21:52 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTikSvU4haNpRmPq8o2P0yB1Y3t0Ahg@mail.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).