summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorTomasz Dziendzielski <tomasz.dziendzielski@gmail.com>2021-02-01 01:32:56 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-11 17:46:11 +0000
commit293329627869571dcfbec5dee0b54a3c7105d4aa (patch)
tree226d2933878410d53f6561c4d07e5b4e4ab3db12 /meta
parentecb66ea62e9bfdeb8e8e170dd104de0236c04a17 (diff)
downloadpoky-293329627869571dcfbec5dee0b54a3c7105d4aa.tar.gz
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] (From OE-Core rev: ca324a6fef99eef638a3577543592443a043f4e7) 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: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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 34558a6672..31a6140984 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -557,9 +557,11 @@ def OEOuthashBasic(path, sigfile, task, d):
557 try: 557 try:
558 update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name) 558 update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
559 update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name) 559 update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
560 except KeyError: 560 except KeyError as e:
561 bb.warn("KeyError in %s" % path) 561 bb.warn("KeyError in %s" % path)
562 raise 562 msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match "
563 "any user/group on target. This may be due to host contamination." % (e, path, s.st_uid, s.st_gid))
564 raise Exception(msg).with_traceback(e.__traceback__)
563 565
564 if include_timestamps: 566 if include_timestamps:
565 update_hash(" %10d" % s.st_mtime) 567 update_hash(" %10d" % s.st_mtime)