[bitbake-devel] [PATCH v4 08/12] bitbake: fetch2/wget: fix downloadfilename parameter

Christopher Larson kergoth at gmail.com
Fri Jan 17 20:44:00 UTC 2020


This doesn't escape the filename, it quotes it, so should probably correct
the message, and will almost certainly break if the name contains a single
quote. I'd suggest using subprocess.list2cmdline(), pipes.quote(), or
similar instead of doing it manually. Definitely a good fix, just likely
best done with an existing mechanism :) Thanks for the contribution.

On Fri, Jan 17, 2020 at 9:52 AM Jean-Marie LEMETAYER <
jean-marie.lemetayer at savoirfairelinux.com> wrote:

> When using a download filename with characters which can be interpreted
> by the shell ('(', ')', '&', ';', ...) the command fails. Escaping the
> filename fixes the issue.
>
> Signed-off-by: Jean-Marie LEMETAYER <
> jean-marie.lemetayer at savoirfairelinux.com>
> ---
>  lib/bb/fetch2/wget.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
> index 725586d2..6506e1e2 100644
> --- a/lib/bb/fetch2/wget.py
> +++ b/lib/bb/fetch2/wget.py
> @@ -94,9 +94,9 @@ class Wget(FetchMethod):
>          fetchcmd = self.basecmd
>
>          if 'downloadfilename' in ud.parm:
> -            dldir = d.getVar("DL_DIR")
> -            bb.utils.mkdirhier(os.path.dirname(dldir + os.sep +
> ud.localfile))
> -            fetchcmd += " -O " + dldir + os.sep + ud.localfile
> +            localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile)
> +            bb.utils.mkdirhier(os.path.dirname(localpath))
> +            fetchcmd += " -O '%s'" % localpath
>
>          if ud.user and ud.pswd:
>              fetchcmd += " --user=%s --password=%s --auth-no-challenge" %
> (ud.user, ud.pswd)
> --
> 2.20.1
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>


-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20200117/d5bb2eee/attachment.html>


More information about the bitbake-devel mailing list