Skip to content

Commit 440ac5c

Browse files
authored
fix: use Lchown to prevent erroring on broken symlinks (#434)
1 parent 3c1352f commit 440ac5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

envbuilder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro
815815
if err != nil {
816816
return err
817817
}
818-
return os.Chown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
818+
return os.Lchown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
819819
}); chownErr != nil {
820820
opts.Logger(log.LevelError, "chown %q: %s", execArgs.UserInfo.user.HomeDir, chownErr.Error())
821821
endStage("⚠️ Failed to the ownership of the workspace, you may need to fix this manually!")
@@ -832,7 +832,7 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro
832832
if err != nil {
833833
return err
834834
}
835-
return os.Chown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
835+
return os.Lchown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
836836
}); chownErr != nil {
837837
opts.Logger(log.LevelError, "chown %q: %s", execArgs.UserInfo.user.HomeDir, chownErr.Error())
838838
endStage("⚠️ Failed to update ownership of %s, you may need to fix this manually!", execArgs.UserInfo.user.HomeDir)

0 commit comments

Comments
 (0)