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 EdSchouten committed Jul 8, 2024
1 parent 027b96b commit a2eab49
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 @@ -859,7 +859,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 a2eab49

Please sign in to comment.