Re: [PATCH 10/20] git-submodule.sh: avoid "test <cond> -a/-o <cond>"

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

 



Am 6/10/2014 8:52, schrieb Johannes Sixt:
> Am 6/10/2014 1:23, schrieb Junio C Hamano:
>> Elia Pinto <gitter.spiros@xxxxxxxxx> writes:
>>
>>> @@ -1059,13 +1059,17 @@ cmd_summary() {
>>>  		while read mod_src mod_dst sha1_src sha1_dst status sm_path
>>>  		do
>>>  			# Always show modules deleted or type-changed (blob<->module)
>>> -			test $status = D -o $status = T && echo "$sm_path" && continue
>>> +			case "$status" in
>>> +			[DT])
>>> +				printf '%s\n' "$sm_path" &&
>>> +				continue
>>> +			esac
>>
>> I think this conversion is wrong and causes parse error.  The
>> surrounding code cannot be seen in the context of thsi patch, but
>> looks somewhat like this:
>>
>> 	modules=$( ....
>>                    case "$status" in
>>                    [DT])
>>                            ...
>>                    esac
>>                    .... )
>>
>> Perhaps you would need to spell it with the extra opening
>> parenthesis, like so:
>>
>> 	case string in
>>         ([DT])
>>         	...
>> 	esac
>>
>> or something.
> 
> Do you just think that it causes parse errors or did you actually observe
> them? Because I think that no parse error should occur.

(I should not talk, but test...) bash and zsh get it wrong, dash and ksh
get it right.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03
item 5 does leave some leeway for interpretation. So it's better to adjust
as you suggest.

-- Hannes
-- 
"Atomic objects are neither active nor radioactive." --
Programming Languages -- C++, Final Committee Draft (Doc.N3092)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]