From 94fca8cdc20bf7d313c45dc6b728e99e49ed2fec Mon Sep 17 00:00:00 2001 From: Nils Wireklint Date: Tue, 4 Jun 2024 14:51:34 +0200 Subject: [PATCH] Windows: Hardlinks do not need write permission 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. --- pkg/filesystem/local_directory_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/filesystem/local_directory_windows.go b/pkg/filesystem/local_directory_windows.go index f43ce09c..e8a04f46 100644 --- a/pkg/filesystem/local_directory_windows.go +++ b/pkg/filesystem/local_directory_windows.go @@ -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 }