Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support/download: protect from custom commands with spaces in args
Date: Sat, 12 Dec 2015 17:01:02 +0100	[thread overview]
Message-ID: <20151212170102.17c6b21a@free-electrons.com> (raw)
In-Reply-To: <1449480415-10043-1-git-send-email-yann.morin.1998@free.fr>

Dear Yann E. MORIN,

On Mon,  7 Dec 2015 10:26:55 +0100, Yann E. MORIN wrote:
> Some users may provide custom download commands with spaces in their
> arguments, like so:
>     BR2_HG="hg --config foo.bar='some space-separated value'"
> 
> However, the way we currently call those commands does not account
> for the extra quotes, and each space-separated part of the command is
> interpreted as separate arguments.
> 
> Fix that by calling 'eval' on the commands.
> 
> Because of the eval, we must further quote our own arguments, to avoid
> the eval further splitting them in case there are spaces (even though
> we do not support paths with spaces, better be clean from the onset to
> avoid breakage in the future).
> 
> We change all the wrappers to use a wrapper-function, even those with
> a single call, so they all look alike.
> 
> Note that we do not single-quote some of the variables, like ${verbose}
> because it can be empty and we really do not want to generate an
> empty-string argument. That's not a problem, as ${verbose} would not
> normally contain space-separated values (it could get set to something
> like '-q -v' but in that case we'd still want two arguments, so that's
> fine).
> 
> Reported-by: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> ---
>  support/download/bzr  |  8 +++++++-
>  support/download/cp   |  8 +++++++-
>  support/download/cvs  | 10 ++++++++--
>  support/download/git  | 14 ++++++++++----
>  support/download/hg   | 14 ++++++++++----
>  support/download/scp  |  8 +++++++-
>  support/download/svn  |  8 +++++++-
>  support/download/wget |  8 +++++++-
>  8 files changed, 63 insertions(+), 15 deletions(-)

Applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  parent reply	other threads:[~2015-12-12 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07  9:26 [Buildroot] [PATCH] support/download: protect from custom commands with spaces in args Yann E. MORIN
2015-12-11 10:06 ` Thomas De Schampheleire
2015-12-12 16:01 ` Thomas Petazzoni [this message]
     [not found] ` <20160124020636.GA1387@jack.zhora.eu>
2016-01-24 15:49   ` Yann E. MORIN
2016-01-25 12:45     ` Andi Shyti
2016-01-25 13:19       ` Thomas De Schampheleire

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=20151212170102.17c6b21a@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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