Re: [PATCH 7/8] oe-git-proxy.sh: Add a new comprehensive git proxy script

Darren Hart
2013-02-05T18:00:10Z

On 02/05/2013 08:36 AM, Enrico Scholz wrote:
> Darren Hart <dvhart@linux.intel.com> writes:
>
>>>> + $NC -X connect $*
>>>
>>> why '$*' but not '"$@*"'?
>>>
>> I'm not familiar with $@*
>
> sorry... I meant "$@"
>
>
>> As for $* versus $@, the issue is how the arguments are presented. $*
>> as a single word, $@ each argument is quoted separately. I believe I
>> ran into issues with $@. I haven't had any trouble with $*.
>
> $* is causing trouble all the time because it does not retain whitespaces
> or empty parameters. There are only very few cases, where $* makes sense.
>
>
>> Is there a particular use case where you can see this failing as is?
>
> "$@" is just the right thing to do in this situation. E.g. when your
> script is called as
>
> | oe-git-proxy.sh "${HOST}" "${PORT}"
>
> and HOST is undefined due to some reason, you will try to connect to
> "${PORT}" with $*. The "$@" will cause nc to complain about the broken
> HOST parameter.
>
>
> Btw...
>
> | exec $NC $METHOD "$@"
>
> would be the school book implementation for the thing you want to do...
>
>
>
> Enrico

That all makes sense. When I read up the difference again in the bash
documentation I was surprised I had used $*, but thought I had done that
dance already. I'll update with "$@" and do some tests.

Thank you for the review and catching that.

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel