Re: [PATCH v2] t8002: fix ambiguous printf conversion specifications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Palus <jpalus@xxxxxxxxxxxx> writes:

> -	$(printf "%0.s " $(test_seq 11)) (<author@xxxxxxxxxxx> 2005-04-07 15:45:13 -0700 1) abbrev
> +	$(printf "%11s" "") (<author@xxxxxxxxxxx> 2005-04-07 15:45:13 -0700 1) abbrev

This obviously is much clearer than the obscure original that
concatenates " " 11 times (for 11 arguments that printf receives).

Nice.

> @@ -146,7 +146,7 @@ test_expect_success 'blame --abbrev -b truncates the blank boundary' '
>  
>  test_expect_success 'blame with excessive --abbrev and -b culls to hash length' '
>  	cat >expect <<-EOF &&
> -	$(printf "%0.s " $(test_seq $hexsz)) (<author@xxxxxxxxxxx> 2005-04-07 15:45:13 -0700 1) abbrev
> +	$(printf "%${hexsz}s" "") (<author@xxxxxxxxxxx> 2005-04-07 15:45:13 -0700 1) abbrev

The fact that $hexsz was not quoted in the original made me look at
how it is defined (as an unquoted variable reference is often a way
to lose unwanted leading whitespaces, e.g. bytes=$(wc -c <foo) &&
show $bytes), but it seems that hexsz would not get any leading (or
trailing) whitespaces so this rewrite perfectly fine.

Thanks.  Will queue.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux