diff options
author | Christopher Larson <chris_larson@mentor.com> | 2015-07-31 11:16:46 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-01 11:31:06 +0100 |
commit | e691312a3add222b04e7b2f52f8df6abcb9068bf (patch) | |
tree | c6fdde1aa3b8db426b3b1393ba63b0fc17fdaa0c /lib/bb/parse/__init__.py | |
parent | 9b95fa94eaae452ac7814f1e67c2f7a6314c52f1 (diff) | |
download | bitbake-contrib-e691312a3add222b04e7b2f52f8df6abcb9068bf.tar.gz |
bb.parse: properly error out on filesystem errors
We've had a long-standing bug where a legitimate error reading a file (IOError
or OSError) is always suppressed as though it was a 'file not found' case. As
a concrete example, if you do a `chmod 000 conf/local.conf`, it'll silently
not parse local.conf, rather than erroring to let the user know about the
problem.
Fix this by handling the ENOENT case specifically.
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/parse/__init__.py')
-rw-r--r-- | lib/bb/parse/__init__.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py index 4a78e183a..1becaa4f0 100644 --- a/lib/bb/parse/__init__.py +++ b/lib/bb/parse/__init__.py @@ -26,9 +26,10 @@ File parsers for the BitBake build tools. handlers = [] +import errno +import logging import os import stat -import logging import bb import bb.utils import bb.siggen @@ -122,12 +123,12 @@ def resolve_file(fn, d): for af in attempts: mark_dependency(d, af) if not newfn: - raise IOError("file %s not found in %s" % (fn, bbpath)) + raise IOError(errno.ENOENT, "file %s not found in %s" % (fn, bbpath)) fn = newfn mark_dependency(d, fn) if not os.path.isfile(fn): - raise IOError("file %s not found" % fn) + raise IOError(errno.ENOENT, "file %s not found" % fn) return fn |