* Bug report: $program_name in error message
@ 2016-12-18 20:36 Josh Bleecher Snyder
2016-12-18 21:34 ` Stefan Beller
0 siblings, 1 reply; 9+ messages in thread
From: Josh Bleecher Snyder @ 2016-12-18 20:36 UTC (permalink / raw)
To: git
To reproduce, run 'git submodule' from within a bare repo. Result:
$ git submodule
fatal: $program_name cannot be used without a working tree.
Looks like the intent was for $program_name to be interpolated.
As an aside, I sent a message a few days ago about a segfault when
working with a filesystem with direct_io on, but it appears not to
have made it to the archives on marc.info. Am I perhaps still
greylisted?
Thanks,
Josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-18 20:36 Bug report: $program_name in error message Josh Bleecher Snyder
@ 2016-12-18 21:34 ` Stefan Beller
2016-12-18 21:44 ` Josh Bleecher Snyder
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Beller @ 2016-12-18 21:34 UTC (permalink / raw)
To: Josh Bleecher Snyder; +Cc: git
On Sun, Dec 18, 2016 at 12:36 PM, Josh Bleecher Snyder
<josharian@gmail.com> wrote:
> To reproduce, run 'git submodule' from within a bare repo. Result:
>
> $ git submodule
> fatal: $program_name cannot be used without a working tree.
>
> Looks like the intent was for $program_name to be interpolated.
Which version of git do you use?
>
>
> As an aside, I sent a message a few days ago about a segfault when
> working with a filesystem with direct_io on, but it appears not to
> have made it to the archives on marc.info. Am I perhaps still
> greylisted?
Both emails show up in my mailbox (subscribed to the mailing list),
so I think that just nobody answered your first email as the answer
may be non trivial.
>
> Thanks,
> Josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-18 21:34 ` Stefan Beller
@ 2016-12-18 21:44 ` Josh Bleecher Snyder
2016-12-19 17:07 ` Stefan Beller
0 siblings, 1 reply; 9+ messages in thread
From: Josh Bleecher Snyder @ 2016-12-18 21:44 UTC (permalink / raw)
To: Stefan Beller; +Cc: git
>> To reproduce, run 'git submodule' from within a bare repo. Result:
>>
>> $ git submodule
>> fatal: $program_name cannot be used without a working tree.
>>
>> Looks like the intent was for $program_name to be interpolated.
>
> Which version of git do you use?
$ git version
git version 2.11.0
>> As an aside, I sent a message a few days ago about a segfault when
>> working with a filesystem with direct_io on, but it appears not to
>> have made it to the archives on marc.info. Am I perhaps still
>> greylisted?
>
> Both emails show up in my mailbox (subscribed to the mailing list),
> so I think that just nobody answered your first email as the answer
> may be non trivial.
Thanks for the confirmation.
-josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-18 21:44 ` Josh Bleecher Snyder
@ 2016-12-19 17:07 ` Stefan Beller
2016-12-19 20:44 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Beller @ 2016-12-19 17:07 UTC (permalink / raw)
To: Josh Bleecher Snyder, vascomalmeida; +Cc: git
+ Vasco Almeida, who authored d323c6b641,
(i18n: git-sh-setup.sh: mark strings for translation, 2016-06-17)
On Sun, Dec 18, 2016 at 1:44 PM, Josh Bleecher Snyder
<josharian@gmail.com> wrote:
>>> To reproduce, run 'git submodule' from within a bare repo. Result:
>>>
>>> $ git submodule
>>> fatal: $program_name cannot be used without a working tree.
>>>
>>> Looks like the intent was for $program_name to be interpolated.
>>
>> Which version of git do you use?
>
> $ git version
> git version 2.11.0
>
>
>>> As an aside, I sent a message a few days ago about a segfault when
>>> working with a filesystem with direct_io on, but it appears not to
>>> have made it to the archives on marc.info. Am I perhaps still
>>> greylisted?
>>
>> Both emails show up in my mailbox (subscribed to the mailing list),
>> so I think that just nobody answered your first email as the answer
>> may be non trivial.
>
> Thanks for the confirmation.
>
> -josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-19 17:07 ` Stefan Beller
@ 2016-12-19 20:44 ` Junio C Hamano
2016-12-19 20:50 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2016-12-19 20:44 UTC (permalink / raw)
To: Stefan Beller; +Cc: Josh Bleecher Snyder, vascomalmeida, git
Stefan Beller <sbeller@google.com> writes:
> + Vasco Almeida, who authored d323c6b641,
> (i18n: git-sh-setup.sh: mark strings for translation, 2016-06-17)
Comparing these changes that involve "\$variable" ...
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index c48139a494..2eda134800 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -2,6 +2,9 @@
# to set up some variables pointing at the normal git directories and
# a few helper shell functions.
+# Source git-sh-i18n for gettext support.
+. git-sh-i18n
+
# Having this variable in your environment would break scripts because
# you would cause "cd" to be taken to unexpected places. If you
# like CDPATH, define it for your interactive shell sessions without
@@ -83,16 +86,16 @@ if test -n "$OPTIONS_SPEC"; then
else
dashless=$(basename -- "$0" | sed -e 's/-/ /')
usage() {
- die "usage: $dashless $USAGE"
+ die "$(eval_gettext "usage: \$dashless \$USAGE")"
}
if [ -z "$LONG_USAGE" ]
then
- LONG_USAGE="usage: $dashless $USAGE"
+ LONG_USAGE="$(eval_gettext "usage: \$dashless \$USAGE")"
else
- LONG_USAGE="usage: $dashless $USAGE
+ LONG_USAGE="$(eval_gettext "usage: \$dashless \$USAGE
... and these that appear in the same patch ...
@@ -190,13 +193,16 @@ cd_to_toplevel () {
require_work_tree_exists () {
if test "z$(git rev-parse --is-bare-repository)" != zfalse
then
- die "fatal: $0 cannot be used without a working tree."
+ program_name=$0
+ die "$(gettext "fatal: \$program_name cannot be used without a working tree.")"
fi
}
require_work_tree () {
- test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ||
- die "fatal: $0 cannot be used without a working tree."
+ test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true || {
+ program_name=$0
+ die "$(gettext "fatal: \$program_name cannot be used without a working tree.")"
+ }
}
tells me that the latter needs to be eval_gettext?
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-19 20:44 ` Junio C Hamano
@ 2016-12-19 20:50 ` Junio C Hamano
2016-12-19 23:33 ` Stefan Beller
2016-12-20 14:16 ` Vasco Almeida
0 siblings, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2016-12-19 20:50 UTC (permalink / raw)
To: Stefan Beller; +Cc: Josh Bleecher Snyder, vascomalmeida, git
Junio C Hamano <gitster@pobox.com> writes:
> Comparing these changes that involve "\$variable" ...
>
> dashless=$(basename -- "$0" | sed -e 's/-/ /')
> usage() {
> - die "usage: $dashless $USAGE"
> + die "$(eval_gettext "usage: \$dashless \$USAGE")"
> ... and these that appear in the same patch ...
>
> @@ -190,13 +193,16 @@ cd_to_toplevel () {
> require_work_tree_exists () {
> if test "z$(git rev-parse --is-bare-repository)" != zfalse
> then
> - die "fatal: $0 cannot be used without a working tree."
> + program_name=$0
> + die "$(gettext "fatal: \$program_name cannot be used without a working tree.")"
> ...
>
> tells me that the latter needs to be eval_gettext?
Just for fun:
$ git grep -n '[^_]gettext .*\\\$'
shows three hits. Two of them are from that one.
The other is at git-rebase--interactive.sh:440
Perhaps like this to fix.
-- >8 --
Subject: rebase -i: fix mistaken i18n
f2d17068fd ("i18n: rebase-interactive: mark comments of squash for
translation", 2016-06-17) attempted to apply sh-i18n and failed to
use $(eval_gettext "string with \$variable interpolation").
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
git-rebase--interactive.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 41fd374c72..96865b2375 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -437,7 +437,8 @@ update_squash_messages () {
}' <"$squash_msg".bak
} >"$squash_msg"
else
- commit_message HEAD > "$fixup_msg" || die "$(gettext "Cannot write \$fixup_msg")"
+ commit_message HEAD >"$fixup_msg" ||
+ die "$(eval_gettext "Cannot write \$fixup_msg")"
count=2
{
printf '%s\n' "$comment_char $(gettext "This is a combination of 2 commits.")"
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-19 20:50 ` Junio C Hamano
@ 2016-12-19 23:33 ` Stefan Beller
2016-12-20 14:16 ` Vasco Almeida
1 sibling, 0 replies; 9+ messages in thread
From: Stefan Beller @ 2016-12-19 23:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Josh Bleecher Snyder, vascomalmeida, git
On Mon, Dec 19, 2016 at 12:50 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> -- >8 --
> Subject: rebase -i: fix mistaken i18n
>
> f2d17068fd ("i18n: rebase-interactive: mark comments of squash for
> translation", 2016-06-17) attempted to apply sh-i18n and failed to
> use $(eval_gettext "string with \$variable interpolation").
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Looks sensible.
Thanks,
Stefan
> else
> - commit_message HEAD > "$fixup_msg" || die "$(gettext "Cannot write \$fixup_msg")"
> + commit_message HEAD >"$fixup_msg" ||
> + die "$(eval_gettext "Cannot write \$fixup_msg")"
> count=2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-19 20:50 ` Junio C Hamano
2016-12-19 23:33 ` Stefan Beller
@ 2016-12-20 14:16 ` Vasco Almeida
2016-12-20 17:41 ` Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Vasco Almeida @ 2016-12-20 14:16 UTC (permalink / raw)
To: Junio C Hamano, Stefan Beller; +Cc: Josh Bleecher Snyder, git
Thanks for the report and letting me know.
Yes, these were mistakes and lack of attention mine. It was supposed to
call 'eval_gettext' rather than 'gettext' when \$variable interpolation
is needed. Junio Hamano has the right answer for these errors.
A Seg, 19-12-2016 às 12:50 -0800, Junio C Hamano escreveu:
> Subject: rebase -i: fix mistaken i18n
>
> f2d17068fd ("i18n: rebase-interactive: mark comments of squash for
> translation", 2016-06-17) attempted to apply sh-i18n and failed to
> use $(eval_gettext "string with \$variable interpolation").
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> git-rebase--interactive.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 41fd374c72..96865b2375 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -437,7 +437,8 @@ update_squash_messages () {
> }' <"$squash_msg".bak
> } >"$squash_msg"
> else
> - commit_message HEAD > "$fixup_msg" || die "$(gettext "Cannot write \$fixup_msg")"
> + commit_message HEAD >"$fixup_msg" ||
> + die "$(eval_gettext "Cannot write \$fixup_msg")"
> count=2
> {
> printf '%s\n' "$comment_char $(gettext "This is a combination of 2 commits.")"
I agree with this fix. Perhaps indent the second line to be easier on
the eyes?:
> + commit_message HEAD >"$fixup_msg" ||
> + die "$(eval_gettext "Cannot write \$fixup_msg")"
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug report: $program_name in error message
2016-12-20 14:16 ` Vasco Almeida
@ 2016-12-20 17:41 ` Junio C Hamano
0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2016-12-20 17:41 UTC (permalink / raw)
To: Vasco Almeida; +Cc: Stefan Beller, Josh Bleecher Snyder, git
Vasco Almeida <vascomalmeida@sapo.pt> writes:
> Thanks for the report and letting me know.
> Yes, these were mistakes and lack of attention mine. It was supposed to
> call 'eval_gettext' rather than 'gettext' when \$variable interpolation
> is needed.
Thanks.
As both of the offending commits (d323c6b641 & f2d17068fd) were part
of the topic that was merged at 2703572b3a ("Merge branch
'va/i18n-even-more'", 2016-07-13), I'll queue this single patch on
top of 2703572b3a^2 (i.e. the tip of the topic).
-- >8 --
Subject: [PATCH] i18n: fix misconversion in shell scripts
An earlier series that was merged at 2703572b3a ("Merge branch
'va/i18n-even-more'", 2016-07-13) failed to use $(eval_gettext
"string with \$variable interpolation") and instead used gettext in
a few places, and ended up showing the variable names in the
message, e.g.
$ git submodule
fatal: $program_name cannot be used without a working tree.
Catch these mistakes with
$ git grep -n '[^_]gettext .*\\\$'
and fix them all to use eval_gettext instead.
Reported-by: Josh Bleecher Snyder
Acked-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
git-rebase--interactive.sh | 3 ++-
git-sh-setup.sh | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a545d92c26..c5806859f0 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -467,7 +467,8 @@ update_squash_messages () {
}' <"$squash_msg".bak
} >"$squash_msg"
else
- commit_message HEAD > "$fixup_msg" || die "$(gettext "Cannot write \$fixup_msg")"
+ commit_message HEAD >"$fixup_msg" ||
+ die "$(eval_gettext "Cannot write \$fixup_msg")"
count=2
{
printf '%s\n' "$comment_char $(gettext "This is a combination of 2 commits.")"
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 2eda134800..c7b2a95463 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -194,14 +194,14 @@ require_work_tree_exists () {
if test "z$(git rev-parse --is-bare-repository)" != zfalse
then
program_name=$0
- die "$(gettext "fatal: \$program_name cannot be used without a working tree.")"
+ die "$(eval_gettext "fatal: \$program_name cannot be used without a working tree.")"
fi
}
require_work_tree () {
test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true || {
program_name=$0
- die "$(gettext "fatal: \$program_name cannot be used without a working tree.")"
+ die "$(eval_gettext "fatal: \$program_name cannot be used without a working tree.")"
}
}
--
2.11.0-416-g1351c11cce
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-12-20 17:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-18 20:36 Bug report: $program_name in error message Josh Bleecher Snyder
2016-12-18 21:34 ` Stefan Beller
2016-12-18 21:44 ` Josh Bleecher Snyder
2016-12-19 17:07 ` Stefan Beller
2016-12-19 20:44 ` Junio C Hamano
2016-12-19 20:50 ` Junio C Hamano
2016-12-19 23:33 ` Stefan Beller
2016-12-20 14:16 ` Vasco Almeida
2016-12-20 17:41 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.