diff options
| author | Michael Vogt <mvo@ubuntu.com> | 2016-08-11 19:47:40 +0200 |
|---|---|---|
| committer | Michael Vogt <mvo@ubuntu.com> | 2016-08-11 19:53:35 +0200 |
| commit | 6c8bc93094c984ce9c37aa7ab503bfc45fe7f888 (patch) | |
| tree | f5df655d1a52ddace731a3e4cb2f424e3ef76bd8 | |
| parent | 344ff251a218e8a0aa82a969d56a2b4438ef50e3 (diff) | |
Do not error if the SUDO_USER can not be looked upbugfix/real-pbuilder-user
This is not an error, it may happen if e.g. sudo is used to enter a chroot. This is what pbulider is doing and RealUser() breaks building snapd with pbuilder (a very common use-case).
| -rw-r--r-- | osutil/user.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/osutil/user.go b/osutil/user.go index afcc59f238..545e18d210 100644 --- a/osutil/user.go +++ b/osutil/user.go @@ -83,6 +83,10 @@ func RealUser() (*user.User, error) { } real, err := user.Lookup(realName) + // can happen when sudo is used to enter a chroot (e.g. pbuilder) + if _, ok := err.(user.UnknownUserError); ok { + return cur, nil + } if err != nil { return nil, err } |
