From 7bf9dccef1aa626adc9c45addcd066fed69cace9 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 9 Jun 2015 17:08:43 +0100 Subject: recipetool: appendfile: fix file command error handling * It turns out that not all versions of the file command support the -E option - the version in Ubuntu 14.04 doesn't support it for example. This option is supposed to force file to return an error if the file can't be opened - since we can't rely upon it then fall back to looking at the output instead. (The results of this issue were simply that we didn't notice if the file was executable and give a warning, which tripped an oe-selftest failure - so it was minor.) * If we receive an error there's not much point looking at the output to see what type was returned because there wasn't one. Signed-off-by: Paul Eggleton --- scripts/lib/recipetool/append.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py index 28015c683d..ed4ce4a805 100644 --- a/scripts/lib/recipetool/append.py +++ b/scripts/lib/recipetool/append.py @@ -262,10 +262,12 @@ def appendfile(args): stdout = '' try: - (stdout, _) = bb.process.run('LANG=C file -E -b %s' % args.newfile, shell=True) + (stdout, _) = bb.process.run('LANG=C file -b %s' % args.newfile, shell=True) + if 'cannot open' in stdout: + raise bb.process.ExecutionError(stdout) except bb.process.ExecutionError as err: logger.debug('file command returned error: %s' % err) - pass + stdout = '' if stdout: logger.debug('file command output: %s' % stdout.rstrip()) if ('executable' in stdout and not 'shell script' in stdout) or 'shared object' in stdout: -- cgit 1.2.3-korg