Skip to content

Commit

Permalink
Windows: Hardlinks do not need write permission
Browse files Browse the repository at this point in the history
This fixes execution errors where some programs fail to execute while a
source file is hardlinked into another scheduled actions. Many compilers
restrict the sharing mode for the files they open, 'cl.exe' for instance
does not allow other processes to have open WRITE handles to its source
files, and fails with SHARING_VIOLATION if such handles are open. The
hardlinking file fetcher does not need this permission and we solve many
crashes by removing it.
  • Loading branch information
Nils Wireklint authored and Nils Wireklint committed Jun 24, 2024
1 parent cfb35ec commit 94fca8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/filesystem/local_directory_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ func buildFileLinkInfo(root windows.Handle, name []uint16) ([]byte, uint32) {

func createNTFSHardlink(oldHandle windows.Handle, oldName string, newHandle windows.Handle, newName string) error {
var handle windows.Handle
err := ntCreateFile(&handle, windows.FILE_GENERIC_READ|windows.FILE_GENERIC_WRITE, oldHandle, oldName, windows.FILE_OPEN, 0)
err := ntCreateFile(&handle, windows.FILE_GENERIC_READ, oldHandle, oldName, windows.FILE_OPEN, 0)
if err != nil {
return err
}
Expand Down

0 comments on commit 94fca8c

Please sign in to comment.