]> code.ossystems Code Review - openembedded-core.git/commitdiff
sstatesig: Improve debug output if getpwuid() fails
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 14 Jan 2020 21:05:10 +0000 (21:05 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 16 Jan 2020 22:21:31 +0000 (22:21 +0000)
If getpwduid fails, we don't see which file it failed on which is key information
to aid debugging. Print this information when exceptions are raised.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/sstatesig.py

index 0e17ad6f5b7034bc2f4a6e561ea051719bf520e3..4325b66a9ee03781b9156b1463c62d11d0c2ac0c 100644 (file)
@@ -541,8 +541,12 @@ def OEOuthashBasic(path, sigfile, task, d):
                     add_perm(stat.S_IXOTH, 'x')
 
                 if include_owners:
-                    update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
-                    update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
+                    try:
+                        update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
+                        update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
+                    except KeyError:
+                        bb.warn("KeyError in %s" % path)
+                        raise
 
                 update_hash(" ")
                 if stat.S_ISBLK(s.st_mode) or stat.S_ISCHR(s.st_mode):