fixup! run: user LookupId

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
Yoan Blanc 2020-03-05 16:49:13 +01:00
parent c7028c6d2f
commit 67fbdef360
No known key found for this signature in database
GPG Key ID: 6058CF4574298812
2 changed files with 7 additions and 7 deletions

View File

@ -130,7 +130,7 @@ func addDefaultHOME(u string, envs []string) ([]string, error) {
// If user is set to username, set value of HOME to /home/${user}
// Otherwise the user is set to uid and HOME is /
userObj, err := userLookup(u)
if err == nil {
if err != nil {
if uo, e := userLookupId(u); e == nil {
userObj = uo
} else {

View File

@ -55,23 +55,23 @@ var userTests = []struct {
expectedUID: "fakeUser",
},
{
user: "root:root",
user: "root",
userObj: &user.User{Uid: "root", Gid: "some"},
expectedUID: "root",
},
{
user: "0:root",
user: "0",
userObj: &user.User{Uid: "0"},
expectedUID: "0",
},
{
user: "root:0",
user: "root",
userObj: &user.User{Uid: "root"},
expectedUID: "root",
expectedGID: "f0",
},
{
user: "0:0",
user: "0",
userObj: &user.User{Uid: "0"},
expectedUID: "0",
},
@ -81,12 +81,12 @@ var userTests = []struct {
expectedUID: "root",
},
{
user: "root:$envgroup",
user: "root",
userObj: &user.User{Uid: "root"},
expectedUID: "root",
},
{
user: "some:grp",
user: "some",
userObj: &user.User{Uid: "some"},
expectedUID: "some",
},