public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Steve Sakoman" <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][dunfell 24/28] sstatesig: Add descriptive error message to getpwuid/getgrgid "uid/gid not found" KeyError
Date: Mon,  8 Feb 2021 03:52:16 -1000	[thread overview]
Message-ID: <508d08bb207f98d5bb2b62ccb07e714fce250154.1612792088.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1612792088.git.steve@sakoman.com>

From: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>

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>
---
 meta/lib/oe/sstatesig.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index f98543cc46..aeceb100d7 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)
-- 
2.25.1


  parent reply	other threads:[~2021-02-08 13:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 13:51 [OE-core][dunfell 00/28] Patch review Steve Sakoman
2021-02-08 13:51 ` [OE-core][dunfell 01/28] pseudo: Update to include passwd and file renaming fixes Steve Sakoman
2021-02-08 13:51 ` [OE-core][dunfell 02/28] sanity.bbclass: Check if PSEUDO_IGNORE_PATHS and paths under pseudo control overlap Steve Sakoman
2021-02-08 13:51 ` [OE-core][dunfell 03/28] ca-certificates: upgrade 20190110 -> 20200601 Steve Sakoman
2021-02-08 13:51 ` [OE-core][dunfell 04/28] ca-certificates: correct upstream version check Steve Sakoman
2021-02-08 13:51 ` [OE-core][dunfell 05/28] ca-certificates: upgrade 20200601 -> 20210119 Steve Sakoman
2021-02-08 13:51 ` [OE-core][dunfell 06/28] cve-check: replace Looseversion with custom version class Steve Sakoman
2021-02-08 13:51 ` [OE-core][dunfell 07/28] cve_check: add CVE_VERSION_SUFFIX to indicate suffix in versioning Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 08/28] openssl: set CVE_VERSION_SUFFIX Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 09/28] package.bbclass: hash equivalency and pr service Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 10/28] package: Ensure do_packagedata is cleaned correctly Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 11/28] kernel.bbclass: fix deployment for initramfs images Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 12/28] linux-yocto/5.4: update to v5.4.90 Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 13/28] linux-yocto-rt/5.4: fix 5.4-stable caused build breakage Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 14/28] linux-yocto/5.4: update to v5.4.94 Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 15/28] buildhistory.bbclass: avoid exception for empty BUILDHISTORY_FEATURES variable Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 16/28] npm.bbclass: use python3 for npm config Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 17/28] python3: Use addtask statement instead of task dependencies Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 18/28] image_types: Ensure tar archives are reproducible Steve Sakoman
2021-02-08 14:20   ` Martin Jansa
2021-02-08 15:52     ` Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 19/28] qemu.inc: Should depend on qemu-system-native, not qemu-native Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 20/28] glib-2.0: Rename patch file for CVE-2020-35457 Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 21/28] layer.conf: fix sanity error for PATH variable in extensible SDK workflow Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 22/28] lib/oe/patch.py: Ignore scissors line on applying patch Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 23/28] opkg: Fix build reproducibility issue Steve Sakoman
2021-02-09 14:34   ` Richard Purdie
2021-02-09 14:40     ` Steve Sakoman
2021-02-08 13:52 ` Steve Sakoman [this message]
2021-02-08 13:52 ` [OE-core][dunfell 25/28] rng-tools: fix rngd_jitter initialization Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 26/28] classes/image_types_wic: Reorder do_flush_pseudodb Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 27/28] oeqa: wic: Add tests for permissions and change-directory Steve Sakoman
2021-02-08 13:52 ` [OE-core][dunfell 28/28] wic/selftest: test_permissions also test bitbake image Steve Sakoman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=508d08bb207f98d5bb2b62ccb07e714fce250154.1612792088.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox