Skip to content

Commit

Permalink
fix: use Lchown to prevent erroring on broken symlinks (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
strike authored Dec 12, 2024
1 parent 3c1352f commit 440ac5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions envbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro
if err != nil {
return err
}
return os.Chown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
return os.Lchown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
}); chownErr != nil {
opts.Logger(log.LevelError, "chown %q: %s", execArgs.UserInfo.user.HomeDir, chownErr.Error())
endStage("⚠️ Failed to the ownership of the workspace, you may need to fix this manually!")
Expand All @@ -832,7 +832,7 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro
if err != nil {
return err
}
return os.Chown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
return os.Lchown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
}); chownErr != nil {
opts.Logger(log.LevelError, "chown %q: %s", execArgs.UserInfo.user.HomeDir, chownErr.Error())
endStage("⚠️ Failed to update ownership of %s, you may need to fix this manually!", execArgs.UserInfo.user.HomeDir)
Expand Down

0 comments on commit 440ac5c

Please sign in to comment.