Re: [PATCH] send-email: improve recipients_cmd()

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

 



On Sun, Apr 28, 2013 at 2:18 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:
>
>> We don't need to quote the filename to pass to the command, we can use
>> an array of all the arguments to pass to the command, which is safer,
>> and more extensible.
>>
>> Commit a47eab0 (send-email: use the three-arg form of open in
>> recipients_cmd) stated we couldn't pass $file directly, but in fact, we
>> can, the multi-word string is passed as is, and we can pass an array
>> too.
>
> I think the comment is not about passing $file directly, but is
> about passing $cmd that could be multi-word string directly.  The
> caller expects it be split into command and its earlier part of
> command line parameters, so that you can say
>
>     $cmd = "cccmd --frotz --nitfol"

I see.

> but the non-string form of open would not give you that, unless you
> rewrite it to
>
>         open $fh, "-|", qw(sh -c), $cmd, @args

That doesn't seem to work for me.

It would have to be:

  open $fh, "-|", qw(sh -c), "$cmd \Q$args\E"

So we end up in the same place.

-- 
Felipe Contreras
--
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]