{"thread":{"id":"44732","subject":"Bug report: $program_name in error message","startedAt":"2016-12-18T20:37:42Z","lastAt":"2016-12-20T17:41:24Z","messageCount":9,"participants":["Josh Bleecher Snyder","Stefan Beller","Junio C Hamano","Vasco Almeida"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"308000","messageId":"CAFAcib8yauNRB6UbO8qS2_Ff4fDt-7mMsmgop8d1V0j=RoTBSA@mail.gmail.com","threadId":"44732","inReplyTo":null,"subject":"Bug report: $program_name in error message","fromName":"Josh Bleecher Snyder","fromEmail":"josharian@gmail.com","sentAt":"2016-12-18T20:36:01Z","receivedAt":"2016-12-18T20:37:42Z","isPatch":false,"sender":{"key":"josharian@gmail.com","avatar":"https://gravatar.com/avatar/df58f649b62f4d66e2e635810212cb54403228630fabfa080eb5847a6f4cc01b?d=mp&s=160"},"body":"To reproduce, run 'git submodule' from within a bare repo. Result:\n\n$ git submodule\nfatal: $program_name cannot be used without a working tree.\n\nLooks like the intent was for $program_name to be interpolated.\n\n\nAs an aside, I sent a message a few days ago about a segfault when\nworking with a filesystem with direct_io on, but it appears not to\nhave made it to the archives on marc.info. Am I perhaps still\ngreylisted?\n\nThanks,\nJosh\n"},{"id":"308001","messageId":"CAGZ79kZ=QK5s0_94+4GNs3M5oo49GLm-KkT5K=yZktxX8C4UCw@mail.gmail.com","threadId":"44732","inReplyTo":"CAFAcib8yauNRB6UbO8qS2_Ff4fDt-7mMsmgop8d1V0j=RoTBSA@mail.gmail.com","subject":"Re: Bug report: $program_name in error message","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-12-18T21:34:40Z","receivedAt":"2016-12-18T21:35:43Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Sun, Dec 18, 2016 at 12:36 PM, Josh Bleecher Snyder\n<josharian@gmail.com> wrote:\n> To reproduce, run 'git submodule' from within a bare repo. Result:\n>\n> $ git submodule\n> fatal: $program_name cannot be used without a working tree.\n>\n> Looks like the intent was for $program_name to be interpolated.\n\nWhich version of git do you use?\n\n>\n>\n> As an aside, I sent a message a few days ago about a segfault when\n> working with a filesystem with direct_io on, but it appears not to\n> have made it to the archives on marc.info. Am I perhaps still\n> greylisted?\n\nBoth emails show up in my mailbox (subscribed to the mailing list),\nso I think that just nobody answered your first email as the answer\nmay be non trivial.\n\n>\n> Thanks,\n> Josh\n"},{"id":"308002","messageId":"CAFAcib9-rUSqyBRpauw3pTf9OPTKLYNf7bdh2gyykBNtJTZKGg@mail.gmail.com","threadId":"44732","inReplyTo":"CAGZ79kZ=QK5s0_94+4GNs3M5oo49GLm-KkT5K=yZktxX8C4UCw@mail.gmail.com","subject":"Re: Bug report: $program_name in error message","fromName":"Josh Bleecher Snyder","fromEmail":"josharian@gmail.com","sentAt":"2016-12-18T21:44:44Z","receivedAt":"2016-12-18T21:46:29Z","isPatch":false,"sender":{"key":"josharian@gmail.com","avatar":"https://gravatar.com/avatar/df58f649b62f4d66e2e635810212cb54403228630fabfa080eb5847a6f4cc01b?d=mp&s=160"},"body":">> To reproduce, run 'git submodule' from within a bare repo. Result:\n>>\n>> $ git submodule\n>> fatal: $program_name cannot be used without a working tree.\n>>\n>> Looks like the intent was for $program_name to be interpolated.\n>\n> Which version of git do you use?\n\n$ git version\ngit version 2.11.0\n\n\n>> As an aside, I sent a message a few days ago about a segfault when\n>> working with a filesystem with direct_io on, but it appears not to\n>> have made it to the archives on marc.info. Am I perhaps still\n>> greylisted?\n>\n> Both emails show up in my mailbox (subscribed to the mailing list),\n> so I think that just nobody answered your first email as the answer\n> may be non trivial.\n\nThanks for the confirmation.\n\n-josh\n"},{"id":"308058","messageId":"CAGZ79ka=RzAjrb=7u7p5xnveo=kcNCoGn=TC=0j-CBp8Oby7OA@mail.gmail.com","threadId":"44732","inReplyTo":"CAFAcib9-rUSqyBRpauw3pTf9OPTKLYNf7bdh2gyykBNtJTZKGg@mail.gmail.com","subject":"Re: Bug report: $program_name in error message","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-12-19T17:07:55Z","receivedAt":"2016-12-19T17:08:56Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"+ Vasco Almeida, who authored d323c6b641,\n(i18n: git-sh-setup.sh: mark strings for translation, 2016-06-17)\n\nOn Sun, Dec 18, 2016 at 1:44 PM, Josh Bleecher Snyder\n<josharian@gmail.com> wrote:\n>>> To reproduce, run 'git submodule' from within a bare repo. Result:\n>>>\n>>> $ git submodule\n>>> fatal: $program_name cannot be used without a working tree.\n>>>\n>>> Looks like the intent was for $program_name to be interpolated.\n>>\n>> Which version of git do you use?\n>\n> $ git version\n> git version 2.11.0\n>\n>\n>>> As an aside, I sent a message a few days ago about a segfault when\n>>> working with a filesystem with direct_io on, but it appears not to\n>>> have made it to the archives on marc.info. Am I perhaps still\n>>> greylisted?\n>>\n>> Both emails show up in my mailbox (subscribed to the mailing list),\n>> so I think that just nobody answered your first email as the answer\n>> may be non trivial.\n>\n> Thanks for the confirmation.\n>\n> -josh\n"},{"id":"308090","messageId":"xmqqk2avodi1.fsf@gitster.mtv.corp.google.com","threadId":"44732","inReplyTo":"CAGZ79ka=RzAjrb=7u7p5xnveo=kcNCoGn=TC=0j-CBp8Oby7OA@mail.gmail.com","subject":"Re: Bug report: $program_name in error message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-12-19T20:44:22Z","receivedAt":"2016-12-19T20:45:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> + Vasco Almeida, who authored d323c6b641,\n> (i18n: git-sh-setup.sh: mark strings for translation, 2016-06-17)\n\nComparing these changes that involve \"\\$variable\" ...\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex c48139a494..2eda134800 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -2,6 +2,9 @@\n # to set up some variables pointing at the normal git directories and\n # a few helper shell functions.\n \n+# Source git-sh-i18n for gettext support.\n+. git-sh-i18n\n+\n # Having this variable in your environment would break scripts because\n # you would cause \"cd\" to be taken to unexpected places.  If you\n # like CDPATH, define it for your interactive shell sessions without\n@@ -83,16 +86,16 @@ if test -n \"$OPTIONS_SPEC\"; then\n else\n \tdashless=$(basename -- \"$0\" | sed -e 's/-/ /')\n \tusage() {\n-\t\tdie \"usage: $dashless $USAGE\"\n+\t\tdie \"$(eval_gettext \"usage: \\$dashless \\$USAGE\")\"\n \t}\n \n \tif [ -z \"$LONG_USAGE\" ]\n \tthen\n-\t\tLONG_USAGE=\"usage: $dashless $USAGE\"\n+\t\tLONG_USAGE=\"$(eval_gettext \"usage: \\$dashless \\$USAGE\")\"\n \telse\n-\t\tLONG_USAGE=\"usage: $dashless $USAGE\n+\t\tLONG_USAGE=\"$(eval_gettext \"usage: \\$dashless \\$USAGE\n \n\n... and these that appear in the same patch ...\n\n@@ -190,13 +193,16 @@ cd_to_toplevel () {\n require_work_tree_exists () {\n \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n \tthen\n-\t\tdie \"fatal: $0 cannot be used without a working tree.\"\n+\t\tprogram_name=$0\n+\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n \tfi\n }\n \n require_work_tree () {\n-\ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true ||\n-\tdie \"fatal: $0 cannot be used without a working tree.\"\n+\ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true || {\n+\t\tprogram_name=$0\n+\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n+\t}\n }\n \ntells me that the latter needs to be eval_gettext?\n"},{"id":"308091","messageId":"xmqqfuljod70.fsf@gitster.mtv.corp.google.com","threadId":"44732","inReplyTo":"xmqqk2avodi1.fsf@gitster.mtv.corp.google.com","subject":"Re: Bug report: $program_name in error message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-12-19T20:50:59Z","receivedAt":"2016-12-19T20:52:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Comparing these changes that involve \"\\$variable\" ...\n>\n>  \tdashless=$(basename -- \"$0\" | sed -e 's/-/ /')\n>  \tusage() {\n> -\t\tdie \"usage: $dashless $USAGE\"\n> +\t\tdie \"$(eval_gettext \"usage: \\$dashless \\$USAGE\")\"\n> ... and these that appear in the same patch ...\n>\n> @@ -190,13 +193,16 @@ cd_to_toplevel () {\n>  require_work_tree_exists () {\n>  \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n>  \tthen\n> -\t\tdie \"fatal: $0 cannot be used without a working tree.\"\n> +\t\tprogram_name=$0\n> +\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n> ...\n>  \n> tells me that the latter needs to be eval_gettext?\n\nJust for fun:\n\n    $ git grep -n '[^_]gettext .*\\\\\\$'\n\nshows three hits.  Two of them are from that one.\n\nThe other is at git-rebase--interactive.sh:440\n\nPerhaps like this to fix.\n\n-- >8 --\nSubject: rebase -i: fix mistaken i18n\n\nf2d17068fd (\"i18n: rebase-interactive: mark comments of squash for\ntranslation\", 2016-06-17) attempted to apply sh-i18n and failed to\nuse $(eval_gettext \"string with \\$variable interpolation\").\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-rebase--interactive.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 41fd374c72..96865b2375 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -437,7 +437,8 @@ update_squash_messages () {\n \t\t\t}' <\"$squash_msg\".bak\n \t\t} >\"$squash_msg\"\n \telse\n-\t\tcommit_message HEAD > \"$fixup_msg\" || die \"$(gettext \"Cannot write \\$fixup_msg\")\"\n+\t\tcommit_message HEAD >\"$fixup_msg\" ||\n+\t\tdie \"$(eval_gettext \"Cannot write \\$fixup_msg\")\"\n \t\tcount=2\n \t\t{\n \t\t\tprintf '%s\\n' \"$comment_char $(gettext \"This is a combination of 2 commits.\")\"\n"},{"id":"308121","messageId":"CAGZ79kZxxEOXgRv5KJ-mj5Djzx1KbaWr1TGuXeH542EOA5-JWg@mail.gmail.com","threadId":"44732","inReplyTo":"xmqqfuljod70.fsf@gitster.mtv.corp.google.com","subject":"Re: Bug report: $program_name in error message","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-12-19T23:33:17Z","receivedAt":"2016-12-19T23:34:15Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Dec 19, 2016 at 12:50 PM, Junio C Hamano <gitster@pobox.com> wrote:\n\n>\n> -- >8 --\n> Subject: rebase -i: fix mistaken i18n\n>\n> f2d17068fd (\"i18n: rebase-interactive: mark comments of squash for\n> translation\", 2016-06-17) attempted to apply sh-i18n and failed to\n> use $(eval_gettext \"string with \\$variable interpolation\").\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nLooks sensible.\nThanks,\nStefan\n\n>         else\n> -               commit_message HEAD > \"$fixup_msg\" || die \"$(gettext \"Cannot write \\$fixup_msg\")\"\n> +               commit_message HEAD >\"$fixup_msg\" ||\n> +               die \"$(eval_gettext \"Cannot write \\$fixup_msg\")\"\n>                 count=2\n"},{"id":"308143","messageId":"1482243418.2029.10.camel@sapo.pt","threadId":"44732","inReplyTo":"xmqqfuljod70.fsf@gitster.mtv.corp.google.com","subject":"Re: Bug report: $program_name in error message","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-12-20T14:16:58Z","receivedAt":"2016-12-20T14:17:25Z","isPatch":false,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Thanks for the report and letting me know.\nYes, these were mistakes and lack of attention mine. It was supposed to\ncall 'eval_gettext' rather than 'gettext' when \\$variable interpolation\nis needed. Junio Hamano has the right answer for these errors.\n\nA Seg, 19-12-2016 às 12:50 -0800, Junio C Hamano escreveu:\n> Subject: rebase -i: fix mistaken i18n\n> \n> f2d17068fd (\"i18n: rebase-interactive: mark comments of squash for\n> translation\", 2016-06-17) attempted to apply sh-i18n and failed to\n> use $(eval_gettext \"string with \\$variable interpolation\").\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  git-rebase--interactive.sh | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 41fd374c72..96865b2375 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -437,7 +437,8 @@ update_squash_messages () {\n>                         }' <\"$squash_msg\".bak\n>                 } >\"$squash_msg\"\n>         else\n> -               commit_message HEAD > \"$fixup_msg\" || die \"$(gettext \"Cannot write \\$fixup_msg\")\"\n> +               commit_message HEAD >\"$fixup_msg\" ||\n> +               die \"$(eval_gettext \"Cannot write \\$fixup_msg\")\"\n>                 count=2\n>                 {\n>                         printf '%s\\n' \"$comment_char $(gettext \"This is a combination of 2 commits.\")\"\n\nI agree with this fix. Perhaps indent the second line to be easier on\nthe eyes?:\n\n> +               commit_message HEAD >\"$fixup_msg\" ||\n> +               \tdie \"$(eval_gettext \"Cannot write \\$fixup_msg\")\"\n"},{"id":"308154","messageId":"xmqqd1gmlcqr.fsf@gitster.mtv.corp.google.com","threadId":"44732","inReplyTo":"1482243418.2029.10.camel@sapo.pt","subject":"Re: Bug report: $program_name in error message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-12-20T17:41:16Z","receivedAt":"2016-12-20T17:41:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Thanks for the report and letting me know.\n> Yes, these were mistakes and lack of attention mine. It was supposed to\n> call 'eval_gettext' rather than 'gettext' when \\$variable interpolation\n> is needed.\n\nThanks.  \n\nAs both of the offending commits (d323c6b641 & f2d17068fd) were part\nof the topic that was merged at 2703572b3a (\"Merge branch\n'va/i18n-even-more'\", 2016-07-13), I'll queue this single patch on\ntop of 2703572b3a^2 (i.e. the tip of the topic).\n\n-- >8 --\nSubject: [PATCH] i18n: fix misconversion in shell scripts\n\nAn earlier series that was merged at 2703572b3a (\"Merge branch\n'va/i18n-even-more'\", 2016-07-13) failed to use $(eval_gettext\n\"string with \\$variable interpolation\") and instead used gettext in\na few places, and ended up showing the variable names in the\nmessage, e.g.\n\n    $ git submodule\n    fatal: $program_name cannot be used without a working tree.\n\nCatch these mistakes with\n\n    $ git grep -n '[^_]gettext .*\\\\\\$'\n\nand fix them all to use eval_gettext instead.\n\nReported-by: Josh Bleecher Snyder\nAcked-by: Vasco Almeida <vascomalmeida@sapo.pt>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-rebase--interactive.sh | 3 ++-\n git-sh-setup.sh            | 4 ++--\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex a545d92c26..c5806859f0 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -467,7 +467,8 @@ update_squash_messages () {\n \t\t\t}' <\"$squash_msg\".bak\n \t\t} >\"$squash_msg\"\n \telse\n-\t\tcommit_message HEAD > \"$fixup_msg\" || die \"$(gettext \"Cannot write \\$fixup_msg\")\"\n+\t\tcommit_message HEAD >\"$fixup_msg\" ||\n+\t\tdie \"$(eval_gettext \"Cannot write \\$fixup_msg\")\"\n \t\tcount=2\n \t\t{\n \t\t\tprintf '%s\\n' \"$comment_char $(gettext \"This is a combination of 2 commits.\")\"\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 2eda134800..c7b2a95463 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -194,14 +194,14 @@ require_work_tree_exists () {\n \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n \tthen\n \t\tprogram_name=$0\n-\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n+\t\tdie \"$(eval_gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n \tfi\n }\n \n require_work_tree () {\n \ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true || {\n \t\tprogram_name=$0\n-\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n+\t\tdie \"$(eval_gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n \t}\n }\n \n-- \n2.11.0-416-g1351c11cce\n\n"}]}