[OE-core] [PATCH] archiver: avoid empty incfile in ar_recipe
Grygorii Tertychnyi (gtertych)
gtertych at cisco.com
Mon Nov 11 12:29:42 UTC 2019
Hi Andrei,
From: Andrei Gherzan <andrei at gherzan.ro>
Sent: Monday, November 11, 2019 13:18
Subject: Re: [OE-core] [PATCH] archiver: avoid empty incfile in ar_recipe
>> 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.
> "${...}" it's already expanded to a white-space. So in that case it
> matches "include ".
No. "incfile" is not expanded here, it actually contains "${...}", e.g.
${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'perf-perl.inc', '', d)}
>> Then,
>>
>> 443 incfile = d.expand(incfile)
>>
>> Now "incfile" is empty and nobody checks it.
> incfile is not empty. It's actually a string containing one white-space.
It is actually empty, e.g. "".
>>
>> 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.
>>
> The include regex is the following:
>
> include_re = re.compile( r"include\s+(.+)" )
>
> The issue is that when this is matched on a string suffixed with only
> spaces, it will match the last space as group(1). This is because ".+"
> forces to match the last white-space. Changing that to ".*" will make
> the group(1) be an empty string and later the if will evaluate False.
I don't see how it helps here.
--
Grygorii
More information about the Openembedded-core
mailing list