From d0d76db145195d138e1a73b14a673de9253ef6c0 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 4d90b96d..ae2061d7 100644 --- a/pkg/filesystem/local_directory_windows.go +++ b/pkg/filesystem/local_directory_windows.go @@ -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 }