aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Dziendzielski <tomasz.dziendzielski@gmail.com>2021-02-01 01:32:56 +0100
committerSteve Sakoman <steve@sakoman.com>2021-02-09 06:12:09 -1000
commit887f0a606dd323de1098e8e8a0d65b8351b4006d (patch)
tree1b8c88d7b42364e151efc22f7f9f91f646f71527
parent22b0bd5ad09a0ac40f1d8043266fa5b68b532802 (diff)
downloadopenembedded-core-contrib-887f0a606dd323de1098e8e8a0d65b8351b4006d.tar.gz
openembedded-core-contrib-887f0a606dd323de1098e8e8a0d65b8351b4006d.tar.bz2
openembedded-core-contrib-887f0a606dd323de1098e8e8a0d65b8351b4006d.zip
sstatesig: Add descriptive error message to getpwuid/getgrgid "uid/gid not found" KeyError
If path is not owned by any user installed on target it gives insufficient error "getpwuid(): uid not found" which may be misleading. This exception occurs if uid/gid of path was not found in PSEUDO_PASSWD files, which simply means the path is owned by host user and there is host user contamination. Add more information to the exception message to make it easier for user to debug. [YOCTO #14031] Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 38540b59ed4ec8632e30a5fd6364b010d9da8470) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/lib/oe/sstatesig.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index f98543cc46d..aeceb100d7c 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -552,9 +552,11 @@ def OEOuthashBasic(path, sigfile, task, d):
try:
update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
- except KeyError:
+ except KeyError as e:
bb.warn("KeyError in %s" % path)
- raise
+ msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match "
+ "any user/group on target. This may be due to host contamination." % (e, path, s.st_uid, s.st_gid))
+ raise Exception(msg).with_traceback(e.__traceback__)
if include_timestamps:
update_hash(" %10d" % s.st_mtime)