Skip to contentSkip to conversation

28/29: sstatesig: Improve debug output if getpwuid() fails

oe-commits Martin Jansa 2 participants 2 messages Jan 14, 2020 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Would it makes sense to print the exception in the same bb.warn, so that the missing UID is written in the same line as the path - not in the exception stack trace printed after? But maybe it's not important as with raise there will always be just one exception like this and it will be printed immediately after (while in my debug before I was listing all the files with this issue without leaving the build to fail).

Quoted 51 lines · On Tue, Jan 14, 2020 at 10:25 PM <[email protected]> wrote:

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 237b805cd97cede15a0a2985e80d7b79d78db880
Author: Richard Purdie <[email protected]>
AuthorDate: Tue Jan 14 21:05:10 2020 +0000

sstatesig: Improve debug output if getpwuid() fails

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.

---
 meta/lib/oe/sstatesig.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta/lib/oe/sstatesig.py +6 -2
index 0e17ad6..4325b66 100644
@@ -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):

--
To stop receiving notification emails like this one, please contact the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-commits

#3 lore raw
Quoted 7 lines · Martin Jansa

Would it makes sense to print the exception in the same bb.warn, so that the missing UID is written in the same line as the path - not in the exception stack trace printed after? But maybe it's not important as with raise there will always be just one exception like this and it will be printed immediately after (while in my debug before I was listing all the files with this issue without leaving the build to fail).

I'm torn on that, I don't really want to interfere with the error handling path, equally as it stands today the traceback isn't so useful without knowing where it failed. Not straight forward :/.

Cheers,

Richard