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

Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 6, 2011, 07:43 UTC
Message-ID
<4DC3A685.4080300@drmicha.warpmail.net>
In-Reply-To
<7vsjss6hmf.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 05.05.2011 22:02:
Show 27 quoted lines
> Kacper Kornet <draenog@pld-linux.org> writes:
> 
>> In bash and some other shells the script:
>>
>>   x=2; unset a; echo "${a:-'$x'}"
>>
>> prints '2'. However ksh shell prints $x. The quoting is added to
>> reproduce bash behaviour.
> 
> What I happen to have in /usr/bin/ksh
> 
>     $ /usr/bin/ksh --version
>       version         sh (AT&T Research) 93t+ 2009-05-01
> 
> does not seem to have this issue.
> 
> Whose ksh is this?  It is broken.
> 
> POSIX "2.6.2 Parameter Expansion" [*1*] says in ${parameter<op>word},
> "word shall be subjected to tilde expansion, parameter expansion, command
> substitution, and arithmetic expansion", when "a value of word is needed"
> based on the state of parameter.
> 
> I am not opposed to the change, but because it is not "change to more
> general one" but "work around a bug in <this implementation of ksh>", and
> I would like to know what to fill in the blank when I rewrite the proposed
> commit log message.

I'm running all tests with "dash" these days, and I'm pretty sure "these days" started before 34df9ab. Anyways, this test passes with dash. I'd be happy to replace my test shell with an even stricter one if needed.

Show 26 quoted lines
>> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
>> ---
>>  t/t1506-rev-parse-diagnosis.sh |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
>> index 4a6396f..bad09f9 100755
>> --- a/t/t1506-rev-parse-diagnosis.sh
>> +++ b/t/t1506-rev-parse-diagnosis.sh
>> @@ -8,8 +8,8 @@ exec </dev/null
>>  
>>  test_did_you_mean ()
>>  {
>> -	printf "fatal: Path '$2$3' $4, but not ${5:-'$3'}.\n" >expected &&
>> -	printf "Did you mean '$1:$2$3'${2:+ aka '$1:./$3'}?\n" >>expected &&
>> +	printf "fatal: Path '$2$3' $4, but not ${5:-\'$3\'}.\n" >expected &&
>> +	printf "Did you mean '$1:$2$3'${2:+ aka \'$1:./$3\'}?\n" >>expected &&
>>  	test_cmp expected error
>>  }
>>  
>> -- 
>> 1.7.5
> 
> [Reference]
> 
> *1* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02

Other than that, I have no objections if this patch makes more shells happy and no happy ones unhappy.

Is your ksh OK with all other tests?
Michael
Previous: Junio C HamanoNext: Kacper Kornet
Message 3 of 12 in “t1507: change quoting in test_did_you_mean to a more general one”
  1. t1507: change quoting in test_did_you_mean to a more general oneKacper Kornet, May 5, 2011
  2. Junio C HamanoMay 5, 2011
  3. Michael J GruberMay 6, 2011
  4. Kacper KornetMay 6, 2011
  5. Michael J GruberMay 6, 2011
  6. Johannes SixtMay 6, 2011
  7. Michael J GruberMay 6, 2011
  8. Junio C HamanoMay 6, 2011
  9. Junio C HamanoMay 9, 2011
  10. Johannes SixtMay 9, 2011
  11. Junio C HamanoMay 9, 2011
  12. Kacper KornetMay 6, 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.