public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Kacper Kornet <draenog@pld-linux•org>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] t1507: change quoting in test_did_you_mean to a more general one
Date: Thu, 05 May 2011 13:02:16 -0700	[thread overview]
Message-ID: <7vsjss6hmf.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20110505191027.GA3242@camk.edu.pl> (Kacper Kornet's message of "Thu, 5 May 2011 21:10:28 +0200")

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.

> 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

  reply	other threads:[~2011-05-05 20:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 19:10 [PATCH] t1507: change quoting in test_did_you_mean to a more general one Kacper Kornet
2011-05-05 20:02 ` Junio C Hamano [this message]
2011-05-06  7:43   ` Michael J Gruber
2011-05-06  8:51     ` Kacper Kornet
2011-05-06  9:14       ` Michael J Gruber
2011-05-06 10:22     ` Johannes Sixt
2011-05-06 11:10       ` Michael J Gruber
2011-05-06 14:23       ` Junio C Hamano
2011-05-09  4:40       ` Junio C Hamano
2011-05-09  6:39         ` Johannes Sixt
2011-05-09 16:20           ` Junio C Hamano
2011-05-06  8:39   ` Kacper Kornet

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=7vsjss6hmf.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox$(echo .)com \
    --cc=draenog@pld-linux$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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