[OE-core] [PATCH] archiver: avoid empty incfile in ar_recipe

Andrei Gherzan andrei at gherzan.ro
Fri Nov 1 09:59:34 UTC 2019


Hi,

On 01/11/2019 07:10, grygorii tertychnyi via Openembedded-core wrote:
> do_ar_recipe fails on perf recipe on line:
> 
> include ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'perf-perl.inc', '', d)}
> 
> 1. "${...}" part expands into empty string
> 2. bb.utils.which() takes empty string and returns first directory name from bbpath

This doesn't sound sane. If the include directive has no argument, 
incfile should end up None. That's what the code "assumes" at this 
point. I would fix it either at the regex expression level or strip the 
match. I reckon former would make more sense. It sounds like the match 
expression should use * (none or more).

> 3. shutil.copy() fails on copying directory:
> 
> Exception: IsADirectoryError: [Errno 21] Is a directory: ......
> 
> Hence, check "incfile" variable on each step.
> 
> Signed-off-by: grygorii tertychnyi <gtertych at cisco.com>
> ---
>   meta/classes/archiver.bbclass | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
> index 093e2d95af..7c46cff91f 100644
> --- a/meta/classes/archiver.bbclass
> +++ b/meta/classes/archiver.bbclass
> @@ -441,9 +441,10 @@ python do_ar_recipe () {
>               incfile = include_re.match(line).group(1)
>           if incfile:
>               incfile = d.expand(incfile)
> +        if incfile:
>               incfile = bb.utils.which(bbpath, incfile)
> -            if incfile:
> -                shutil.copy(incfile, outdir)
> +        if incfile:
> +            shutil.copy(incfile, outdir)
>   
>       create_tarball(d, outdir, 'recipe', d.getVar('ARCHIVER_OUTDIR'))
>       bb.utils.remove(outdir, recurse=True)
> 


-- 
Andrei Gherzan


More information about the Openembedded-core mailing list