{"thread":{"id":"27276","subject":"[PATCH] t1507: change quoting in test_did_you_mean to a more general one","startedAt":"2011-05-05T19:10:28Z","lastAt":"2011-05-09T16:20:29Z","messageCount":12,"participants":["Kacper Kornet","Junio C Hamano","Michael J Gruber","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"167159","messageId":"20110505191027.GA3242@camk.edu.pl","threadId":"27276","inReplyTo":null,"subject":"[PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2011-05-05T19:10:28Z","receivedAt":"2011-05-05T19:10:28Z","isPatch":true,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"In bash and some other shells the script:\n\nx=2; unset a; echo \"${a:-'$x'}\"\n\nprints '2'. However ksh shell prints $x. The quoting is added to\nreproduce bash behaviour.\n\nSigned-off-by: Kacper Kornet <draenog@pld-linux.org>\n---\n t/t1506-rev-parse-diagnosis.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 4a6396f..bad09f9 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -8,8 +8,8 @@ exec </dev/null\n \n test_did_you_mean ()\n {\n-\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n-\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n+\tprintf \"fatal: Path '$2$3' $4, but not ${5:-\\'$3\\'}.\\n\" >expected &&\n+\tprintf \"Did you mean '$1:$2$3'${2:+ aka \\'$1:./$3\\'}?\\n\" >>expected &&\n \ttest_cmp expected error\n }\n \n-- \n1.7.5\n\n-- \n  Kacper Kornet\n"},{"id":"167175","messageId":"7vsjss6hmf.fsf@alter.siamese.dyndns.org","threadId":"27276","inReplyTo":"20110505191027.GA3242@camk.edu.pl","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-05T20:02:16Z","receivedAt":"2011-05-05T20:02:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kacper Kornet <draenog@pld-linux.org> writes:\n\n> In bash and some other shells the script:\n>\n>   x=2; unset a; echo \"${a:-'$x'}\"\n>\n> prints '2'. However ksh shell prints $x. The quoting is added to\n> reproduce bash behaviour.\n\nWhat I happen to have in /usr/bin/ksh\n\n    $ /usr/bin/ksh --version\n      version         sh (AT&T Research) 93t+ 2009-05-01\n\ndoes not seem to have this issue.\n\nWhose ksh is this?  It is broken.\n\nPOSIX \"2.6.2 Parameter Expansion\" [*1*] says in ${parameter<op>word},\n\"word shall be subjected to tilde expansion, parameter expansion, command\nsubstitution, and arithmetic expansion\", when \"a value of word is needed\"\nbased on the state of parameter.\n\nI am not opposed to the change, but because it is not \"change to more\ngeneral one\" but \"work around a bug in <this implementation of ksh>\", and\nI would like to know what to fill in the blank when I rewrite the proposed\ncommit log message.\n\n> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>\n> ---\n>  t/t1506-rev-parse-diagnosis.sh |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\n> index 4a6396f..bad09f9 100755\n> --- a/t/t1506-rev-parse-diagnosis.sh\n> +++ b/t/t1506-rev-parse-diagnosis.sh\n> @@ -8,8 +8,8 @@ exec </dev/null\n>  \n>  test_did_you_mean ()\n>  {\n> -\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n> -\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n> +\tprintf \"fatal: Path '$2$3' $4, but not ${5:-\\'$3\\'}.\\n\" >expected &&\n> +\tprintf \"Did you mean '$1:$2$3'${2:+ aka \\'$1:./$3\\'}?\\n\" >>expected &&\n>  \ttest_cmp expected error\n>  }\n>  \n> -- \n> 1.7.5\n\n[Reference]\n\n*1* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02\n"},{"id":"167227","messageId":"4DC3A685.4080300@drmicha.warpmail.net","threadId":"27276","inReplyTo":"7vsjss6hmf.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-06T07:43:01Z","receivedAt":"2011-05-06T07:43:01Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 05.05.2011 22:02:\n> Kacper Kornet <draenog@pld-linux.org> writes:\n> \n>> In bash and some other shells the script:\n>>\n>>   x=2; unset a; echo \"${a:-'$x'}\"\n>>\n>> prints '2'. However ksh shell prints $x. The quoting is added to\n>> reproduce bash behaviour.\n> \n> What I happen to have in /usr/bin/ksh\n> \n>     $ /usr/bin/ksh --version\n>       version         sh (AT&T Research) 93t+ 2009-05-01\n> \n> does not seem to have this issue.\n> \n> Whose ksh is this?  It is broken.\n> \n> POSIX \"2.6.2 Parameter Expansion\" [*1*] says in ${parameter<op>word},\n> \"word shall be subjected to tilde expansion, parameter expansion, command\n> substitution, and arithmetic expansion\", when \"a value of word is needed\"\n> based on the state of parameter.\n> \n> I am not opposed to the change, but because it is not \"change to more\n> general one\" but \"work around a bug in <this implementation of ksh>\", and\n> I would like to know what to fill in the blank when I rewrite the proposed\n> commit log message.\n\nI'm running all tests with \"dash\" these days, and I'm pretty sure \"these\ndays\" started before 34df9ab. Anyways, this test passes with dash. I'd\nbe happy to replace my test shell with an even stricter one if needed.\n\n>> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>\n>> ---\n>>  t/t1506-rev-parse-diagnosis.sh |    4 ++--\n>>  1 files changed, 2 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\n>> index 4a6396f..bad09f9 100755\n>> --- a/t/t1506-rev-parse-diagnosis.sh\n>> +++ b/t/t1506-rev-parse-diagnosis.sh\n>> @@ -8,8 +8,8 @@ exec </dev/null\n>>  \n>>  test_did_you_mean ()\n>>  {\n>> -\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n>> -\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n>> +\tprintf \"fatal: Path '$2$3' $4, but not ${5:-\\'$3\\'}.\\n\" >expected &&\n>> +\tprintf \"Did you mean '$1:$2$3'${2:+ aka \\'$1:./$3\\'}?\\n\" >>expected &&\n>>  \ttest_cmp expected error\n>>  }\n>>  \n>> -- \n>> 1.7.5\n> \n> [Reference]\n> \n> *1* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02\n\nOther than that, I have no objections if this patch makes more shells\nhappy and no happy ones unhappy.\n\nIs your ksh OK with all other tests?\n\nMichael\n"},{"id":"167233","messageId":"20110506083937.GA3719@camk.edu.pl","threadId":"27276","inReplyTo":"7vsjss6hmf.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2011-05-06T08:39:37Z","receivedAt":"2011-05-06T08:39:37Z","isPatch":true,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"On Thu, May 05, 2011 at 01:02:16PM -0700, Junio C Hamano wrote:\n> Kacper Kornet <draenog@pld-linux.org> writes:\n\n> > In bash and some other shells the script:\n\n> >   x=2; unset a; echo \"${a:-'$x'}\"\n\n> > prints '2'. However ksh shell prints $x. The quoting is added to\n> > reproduce bash behaviour.\n\n> What I happen to have in /usr/bin/ksh\n\n>     $ /usr/bin/ksh --version\n>       version         sh (AT&T Research) 93t+ 2009-05-01\n\n> does not seem to have this issue.\n\n> Whose ksh is this\n\nIt is pdksh 5.2.14 from http://www.cs.mun.ca/~michael/pdksh/\n\n> It is broken.\n\nYou are right. It is corrected in mksh, which claims to be a successor\nto pdksh. Unfortunately pdksh is used by default as /bin/sh in PLD Linux\nDistribution which are use. Probably the time to think about the change\nof this default.\n\n-- \n  Kacper Kornet\n"},{"id":"167234","messageId":"20110506085107.GB3719@camk.edu.pl","threadId":"27276","inReplyTo":"4DC3A685.4080300@drmicha.warpmail.net","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2011-05-06T08:51:08Z","receivedAt":"2011-05-06T08:51:08Z","isPatch":true,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"On Fri, May 06, 2011 at 09:43:01AM +0200, Michael J Gruber wrote:\n> Junio C Hamano venit, vidit, dixit 05.05.2011 22:02:\n> > Kacper Kornet <draenog@pld-linux.org> writes:\n> >> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>\n> >> ---\n> >>  t/t1506-rev-parse-diagnosis.sh |    4 ++--\n> >>  1 files changed, 2 insertions(+), 2 deletions(-)\n\n> >> diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\n> >> index 4a6396f..bad09f9 100755\n> >> --- a/t/t1506-rev-parse-diagnosis.sh\n> >> +++ b/t/t1506-rev-parse-diagnosis.sh\n> >> @@ -8,8 +8,8 @@ exec </dev/null\n\n> >>  test_did_you_mean ()\n> >>  {\n> >> -\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n> >> -\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n> >> +\tprintf \"fatal: Path '$2$3' $4, but not ${5:-\\'$3\\'}.\\n\" >expected &&\n> >> +\tprintf \"Did you mean '$1:$2$3'${2:+ aka \\'$1:./$3\\'}?\\n\" >>expected &&\n> >>  \ttest_cmp expected error\n> >>  }\n\n> >> -- \n> >> 1.7.5\n\n> > [Reference]\n\n> > *1* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02\n\n> Other than that, I have no objections if this patch makes more shells\n> happy and no happy ones unhappy.\n\n> Is your ksh OK with all other tests?\n\nYes. The only other patch which is applied during our building process\nis: \n\ndiff -ur git-1.7.0.3.orig/t/t1304-default-acl.sh\ngit-1.7.0.3/t/t1304-default-acl\n.sh\n--- git-1.7.0.3.orig/t/t1304-default-acl.sh     2010-03-22\n01:35:03.000000000 +0\n000\n+++ git-1.7.0.3/t/t1304-default-acl.sh  2010-03-23 19:53:49.069813289\n+0000\n@@ -9,6 +9,8 @@\n # => this must come before . ./test-lib.sh\n umask 077\n\n+LOGNAME=$(whoami)\n+\n . ./test-lib.sh\n\n # We need an arbitrary other user give permission to using ACLs. root\n\n\nBut it is specific to our build environment.\n\n-- \n  Kacper Kornet\n"},{"id":"167235","messageId":"4DC3BBEB.1050502@drmicha.warpmail.net","threadId":"27276","inReplyTo":"20110506085107.GB3719@camk.edu.pl","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-06T09:14:19Z","receivedAt":"2011-05-06T09:14:19Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Kacper Kornet venit, vidit, dixit 06.05.2011 10:51:\n> On Fri, May 06, 2011 at 09:43:01AM +0200, Michael J Gruber wrote:\n>> Junio C Hamano venit, vidit, dixit 05.05.2011 22:02:\n>>> Kacper Kornet <draenog@pld-linux.org> writes:\n>>>> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>\n>>>> ---\n>>>>  t/t1506-rev-parse-diagnosis.sh |    4 ++--\n>>>>  1 files changed, 2 insertions(+), 2 deletions(-)\n> \n>>>> diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\n>>>> index 4a6396f..bad09f9 100755\n>>>> --- a/t/t1506-rev-parse-diagnosis.sh\n>>>> +++ b/t/t1506-rev-parse-diagnosis.sh\n>>>> @@ -8,8 +8,8 @@ exec </dev/null\n> \n>>>>  test_did_you_mean ()\n>>>>  {\n>>>> -\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n>>>> -\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n>>>> +\tprintf \"fatal: Path '$2$3' $4, but not ${5:-\\'$3\\'}.\\n\" >expected &&\n>>>> +\tprintf \"Did you mean '$1:$2$3'${2:+ aka \\'$1:./$3\\'}?\\n\" >>expected &&\n>>>>  \ttest_cmp expected error\n>>>>  }\n> \n>>>> -- \n>>>> 1.7.5\n> \n>>> [Reference]\n> \n>>> *1* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02\n> \n>> Other than that, I have no objections if this patch makes more shells\n>> happy and no happy ones unhappy.\n> \n>> Is your ksh OK with all other tests?\n> \n> Yes. The only other patch which is applied during our building process\n> is: \n> \n> diff -ur git-1.7.0.3.orig/t/t1304-default-acl.sh\n> git-1.7.0.3/t/t1304-default-acl\n> .sh\n> --- git-1.7.0.3.orig/t/t1304-default-acl.sh     2010-03-22\n> 01:35:03.000000000 +0\n> 000\n> +++ git-1.7.0.3/t/t1304-default-acl.sh  2010-03-23 19:53:49.069813289\n> +0000\n> @@ -9,6 +9,8 @@\n>  # => this must come before . ./test-lib.sh\n>  umask 077\n> \n> +LOGNAME=$(whoami)\n> +\n>  . ./test-lib.sh\n> \n>  # We need an arbitrary other user give permission to using ACLs. root\n> \n> \n> But it is specific to our build environment.\n> \n\nThanks for the info (and for responding despite my botched to/cc).\n\nIn a different context I noticed that systems don't agree wrt. the\npresence of USER/USERNAME/LOGNAME in the environment. We use LOGNAME in\nt1304 only (and never USER nor USERNAME), but still we might want to do\nsomething like\n\nLOGNAME=${LOGNAME:-$USERNAME}\nLOGNAME=${LOGNAME:-$USER}\nLOGNAME=${LOGNAME:-$(whoami)}\n\nthere, or simpler with ${LOGNAME:=...}, although I don't know what to\ntake for granted.\n\nMichael\n"},{"id":"167242","messageId":"4DC3CBEF.6080303@viscovery.net","threadId":"27276","inReplyTo":"4DC3A685.4080300@drmicha.warpmail.net","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2011-05-06T10:22:39Z","receivedAt":"2011-05-06T10:22:39Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/6/2011 9:43, schrieb Michael J Gruber:\n> Junio C Hamano venit, vidit, dixit 05.05.2011 22:02:\n>> Kacper Kornet <draenog@pld-linux.org> writes:\n>>> -\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n>>> -\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n>>> +\tprintf \"fatal: Path '$2$3' $4, but not ${5:-\\'$3\\'}.\\n\" >expected &&\n>>> +\tprintf \"Did you mean '$1:$2$3'${2:+ aka \\'$1:./$3\\'}?\\n\" >>expected &&\n> Other than that, I have no objections if this patch makes more shells\n> happy and no happy ones unhappy.\n> \n> Is your ksh OK with all other tests?\n\nNote that:\n\n- With the proposed change, bash now prints the backslashes.\n\n- The printfs should be echos, really.\n\n- The behavior of quoting at the right of :- when the ${...:-...} exansion\nappears in double-quotes was debated recently at length at the Austin\ngroup (which revises the POSIX standard). You better move the expansions\nto assignments of temporary variables, where you don't need the\nsurrounding double-quotes:\n\n\tbutnot=${5:-\\'$3\\'} aka=${2:+ aka \\'$1:./$3\\'}\n\nHere, the backslash unambiguously quotes the next character.\n\n-- Hannes\n"},{"id":"167243","messageId":"4DC3D731.3070503@drmicha.warpmail.net","threadId":"27276","inReplyTo":"4DC3CBEF.6080303@viscovery.net","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-06T11:10:41Z","receivedAt":"2011-05-06T11:10:41Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Sixt venit, vidit, dixit 06.05.2011 12:22:\n> Am 5/6/2011 9:43, schrieb Michael J Gruber:\n>> Junio C Hamano venit, vidit, dixit 05.05.2011 22:02:\n>>> Kacper Kornet <draenog@pld-linux.org> writes:\n>>>> -\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n>>>> -\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n>>>> +\tprintf \"fatal: Path '$2$3' $4, but not ${5:-\\'$3\\'}.\\n\" >expected &&\n>>>> +\tprintf \"Did you mean '$1:$2$3'${2:+ aka \\'$1:./$3\\'}?\\n\" >>expected &&\n>> Other than that, I have no objections if this patch makes more shells\n>> happy and no happy ones unhappy.\n>>\n>> Is your ksh OK with all other tests?\n> \n> Note that:\n> \n> - With the proposed change, bash now prints the backslashes.\n> \n> - The printfs should be echos, really.\n\nI thought printfs can be relied upon better than echos (in terms of line\nendings)?\n\n> - The behavior of quoting at the right of :- when the ${...:-...} exansion\n> appears in double-quotes was debated recently at length at the Austin\n> group (which revises the POSIX standard). You better move the expansions\n> to assignments of temporary variables, where you don't need the\n> surrounding double-quotes:\n> \n> \tbutnot=${5:-\\'$3\\'} aka=${2:+ aka \\'$1:./$3\\'}\n> \n> Here, the backslash unambiguously quotes the next character.\n> \n> -- Hannes\n\nWhatever makes most shells happy, as long as that includes current bash...\n\nMichael\n"},{"id":"167250","messageId":"7vmxiz3o3f.fsf@alter.siamese.dyndns.org","threadId":"27276","inReplyTo":"4DC3CBEF.6080303@viscovery.net","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-06T14:23:00Z","receivedAt":"2011-05-06T14:23:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> - The behavior of quoting at the right of :- when the ${...:-...} exansion\n> appears in double-quotes was debated recently at length at the Austin\n> group (which revises the POSIX standard).\n\nNice to have somebody who follows that stuff on the list.\n"},{"id":"167459","messageId":"7voc3cqyfp.fsf@alter.siamese.dyndns.org","threadId":"27276","inReplyTo":"4DC3CBEF.6080303@viscovery.net","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-09T04:40:10Z","receivedAt":"2011-05-09T04:40:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> - The behavior of quoting at the right of :- when the ${...:-...} exansion\n> appears in double-quotes was debated recently at length at the Austin\n> group (which revises the POSIX standard). You better move the expansions\n> to assignments of temporary variables,...\n\nWhat alternative semantics do Austin folks have in mind, by the way?  Just\ndeclare this undefined?\n\nAnyway, let's do this as a future-proofing.  How does this look?\n\n-- >8 --\nSubject: t1507: avoid \"${parameter<op>'word'}\" inside double-quotes\n\nKacper Kornet noticed that a $variable in \"word\" in the above construct is\nnot substituted by his pdksh.  Modern POSIX compliant shells (e.g. dash,\nksh, bash) all seem to interpret POSIX \"2.6.2 Parameter Expansion\" that\nsays \"word shall be subjected to tilde expansion, parameter expansion,\ncommand substitution, and arithmetic expansion\" in ${parameter<op>word},\nto mean that the word is expanded as if it appeared in dq pairs, so if the\nword were \"'$variable'\" (sans dq) it would expand to a single quote, the\nvalue of the $variable and then a single quote.\n\nJohannes Sixt reports that the behavior of quoting at the right of :- when\nthe ${...:-...} expansion appears in double-quotes was debated recently at\nlength at the Austin group.  We can avoid this issue and future-proof the\ntest by a slight rewrite.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1506-rev-parse-diagnosis.sh |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 58575d6..a1081a8 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -8,8 +8,11 @@ exec </dev/null\n \n test_did_you_mean ()\n {\n-\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n-\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n+\tsq=\"'\"\n+\tcat >expected <<-EOF &&\n+\tfatal: Path '$2$3' $4, but not ${5:-$sq$3$sq}.\n+\tDid you mean '$1:$2$3'${2:+ aka $sq$1:./$3$sq}?\n+\tEOF\n \ttest_cmp expected error\n }\n \n"},{"id":"167462","messageId":"4DC78C3C.6060004@viscovery.net","threadId":"27276","inReplyTo":"7voc3cqyfp.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2011-05-09T06:39:56Z","receivedAt":"2011-05-09T06:39:56Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/9/2011 6:40, schrieb Junio C Hamano:\n> Johannes Sixt <j.sixt@viscovery.net> writes:\n> \n>> - The behavior of quoting at the right of :- when the ${...:-...} exansion\n>> appears in double-quotes was debated recently at length at the Austin\n>> group (which revises the POSIX standard). You better move the expansions\n>> to assignments of temporary variables,...\n> \n> What alternative semantics do Austin folks have in mind, by the way?  Just\n> declare this undefined?\n\nMost of the debate centered around how to quote a closing brace: the\nproblem is that usually the backslash within double-quotes is only special\nwhen followed by $, `, or \\, therefore, it should not be possible to quote\na closing brace using \\}. It turned out that different shells handled this\nparticular case differently. IIRC, there were also discrepancies whether\nwhitespace generated on the RHS of :- (or other operators) was retained or\ndiscarded. The conclusion for us as application developers is not to\ndepend on too many subtle details in such a variable expansions because\nthe specification is too vague, shells implement it differently, and some\neven get it outright wrong (as the case discovered by Kascper).\n\n> -\tprintf \"fatal: Path '$2$3' $4, but not ${5:-'$3'}.\\n\" >expected &&\n> -\tprintf \"Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\\n\" >>expected &&\n> +\tsq=\"'\"\n\nThis cuts the && chain.\n\n> +\tcat >expected <<-EOF &&\n> +\tfatal: Path '$2$3' $4, but not ${5:-$sq$3$sq}.\n> +\tDid you mean '$1:$2$3'${2:+ aka $sq$1:./$3$sq}?\n> +\tEOF\n\nLooks good otherwise; I tested this with various shells, and there were no\nsurprises.\n\n-- Hannes\n"},{"id":"167509","messageId":"7vr587q20i.fsf@alter.siamese.dyndns.org","threadId":"27276","inReplyTo":"4DC78C3C.6060004@viscovery.net","subject":"Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-09T16:20:29Z","receivedAt":"2011-05-09T16:20:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Am 5/9/2011 6:40, schrieb Junio C Hamano:\n>> Johannes Sixt <j.sixt@viscovery.net> writes:\n>> \n>>> - The behavior of quoting at the right of :- when the ${...:-...} exansion\n>>> appears in double-quotes was debated recently at length at the Austin\n>>> group (which revises the POSIX standard). You better move the expansions\n>>> to assignments of temporary variables,...\n>> \n>> What alternative semantics do Austin folks have in mind, by the way?  Just\n>> declare this undefined?\n>\n> Most of the debate centered around how to quote a closing brace: the\n\nThanks for a summary.\n\n> Looks good otherwise; I tested this with various shells, and there were no\n> surprises.\n\nThanks, will amend.\n"}]}