tinfoil.py: validate argument in parse_recipe_file
PATCH 1/1 tinfoil.py: validate argument in parse_recipe_file
Check for an empty file name to avoid an exception.
[YOCTO#11210]
--- bitbake/lib/bb/tinfoil.py | 2 ++ 1 file changed, 2 insertions(+)
bitbake/lib/bb/tinfoil.py +2 -0
@@ -399,6 +399,8 @@ class Tinfoil: specify config_data then you cannot use a virtual specification for fn. """ + if not fn: + return None if appends and appendlist == []: appends = False if config_data:
Signature · 1 line
2.7.4
Quoted 6 lines · Juro Bystricky
Check for an empty file name to avoid an exception.
[YOCTO#11210]
Signed-off-by Juro Bystricky <[email protected]>
IMO this is pointless. If you’re calling parse_recipe_file with an empty string, it’s programmer error, which means raising an exception is a completely reasonable thing to do.
Signature · 4 lines
Christopher Larson kergoth at gmail dot com Founder - BitBake, OpenEmbedded, OpenZaurus Senior Software Engineer, Mentor Graphics
parse_recipe can be called from parse_recipe_file as well. If parse_recipe_file is called with a non-existing recipe, you end up with the exception as well. IMHO for a non-existent recipe parse_recipe should return None (instead of an exception)
________________________________
From: Christopher Larson [[email protected]]
Sent: Wednesday, April 05, 2017 6:32 PM
To: Bystricky, Juro
Cc: [email protected]
Subject: Re: [bitbake-devel] [PATCH] tinfoil.py: validate argument in parse_recipe_file
On Wed, Apr 5, 2017 at 2:33 PM, Juro Bystricky <[email protected]<mailto:[email protected]>> wrote:
Check for an empty file name to avoid an exception.
[YOCTO#11210]
IMO this is pointless. If you’re calling parse_recipe_file with an empty string, it’s programmer error, which means raising an exception is a completely reasonable thing to do. --
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
Quoted 4 lines · Juro
parse_recipecan be called fromparse_recipe_fileas well. Ifparse_recipe_fileis called with a non-existing recipe, you end up with the exception as well. IMHO for a non-existent recipeparse_recipeshould return None (instead of an exception)
I'm not sure I agree - an exception under these circumstances seems completely reasonable to me as well.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre