Resolve HOME to the target user's home directory instead of /root

ResolvedUser now carries home, looked up from the image's own
/etc/passwd entry for the final resolved uid (falling back to /root
for uid 0 or / otherwise when there's no matching row). bwrap's HOME
now uses this whenever a user override applies (--user/--group or an
image-declared default user); the plain /root default is kept only
when no override applies at all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gv3s5jckJKzh6JkMoi2Akz
This commit is contained in:
2026-08-22 06:47:16 +00:00
parent 545762d6de
commit 355675b43f
4 changed files with 24 additions and 9 deletions
+1
View File
@@ -45,6 +45,7 @@ std::optional<std::vector<std::string>> wrap_for_root_namespace(const std::strin
struct ResolvedUser {
int uid;
int gid;
std::string home; // from the image's /etc/passwd entry for uid, or a sane fallback
};
// Assembles the full bwrap argv (program name included) to run `command` with