Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skips getting UID/GUID if passwd/group file is not found #2249

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions solver/llbsolver/file/user_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package file

import (
"os"
"syscall"

"github.com/containerd/continuity/fs"
"github.com/moby/buildkit/snapshot"
Expand Down Expand Up @@ -45,6 +46,10 @@ func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.User, error)
}

ufile, err := os.Open(passwdPath)
if errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.ENOTDIR) {
// Couldn't open the file. Considering this case as not finding the user in the file.
claudiubelu marked this conversation as resolved.
Show resolved Hide resolved
break
}
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -95,6 +100,10 @@ func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.User, error)
}

gfile, err := os.Open(groupPath)
if errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.ENOTDIR) {
// Couldn't open the file. Considering this case as not finding the group in the file.
break
}
if err != nil {
return nil, err
}
Expand Down