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

Grygorii Tertychnyi (gtertych) gtertych at cisco.com
Mon Nov 4 15:09:08 UTC 2019


Andrei,

From: Andrei Gherzan <andrei at gherzan.ro>
Sent: Friday, November 1, 2019 13:28
To: Grygorii Tertychnyi (gtertych); openembedded-core at lists.openembedded.org
Cc: xe-linux-external(mailer list)
Subject: Re: [OE-core] [PATCH] archiver: avoid empty incfile in ar_recipe

>> 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

I agree.

> point. I would fix it either at the regex expression level or
> stripping the matched string. I reckon the former makes more sense
> (.*).

Not sure I understand. Archiver class does not interpret "include" directive.
It just parses text files. The regular expression looks correct:

These lines:

440         elif include_re.match(line):
441             incfile = include_re.match(line).group(1)

put "${...}" _string_ into "incfile" variable. So, "incfile" is not None at this stage.
Then, 

443             incfile = d.expand(incfile)

Now "incfile" is empty and nobody checks it.

444             incfile = bb.utils.which(bbpath, incfile)

Now "incfile" is set to first directory name in BBPATH (wrong behavour?)

445             if incfile:
446                 shutil.copy(incfile, outdir)

Exception here: "incfile" is directory, not a file.

-- 
Grygorii


More information about the Openembedded-core mailing list