IsErrNoSpace compared against syscall.ENOSPC. Go defines that constant on Windows as a value in its application reserved range which no Windows API returns, so the comparison could never be true there. A full disk on Windows reports ERROR_DISK_FULL or ERROR_HANDLE_DISK_FULL instead. Preallocation failures were still caught, because those return a separate sentinel, but a disk that is already full fails at the directory creation or at the open long before preallocation is reached. That is the case reported. The errors are now held in a list which platform specific files add to in their init, which is the shape retriable_errors already uses in this package, and the comparison itself is unchanged. Windows appends the two codes that lib/file already recognises when preallocation fails. Every other platform keeps exactly the behaviour it had. This also reaches the VFS cache, which uses the same helper and has no preallocation path of its own, so its out of space handling has been inert on Windows.
18 lines
425 B
Go
18 lines
425 B
Go
//go:build windows
|
|
|
|
package fserrors
|
|
|
|
import (
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func init() {
|
|
// Windows does not return syscall.ENOSPC, which Go defines here as a
|
|
// value in its application reserved range. A full disk reports these.
|
|
// https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
|
|
noSpaceErrors = append(noSpaceErrors,
|
|
windows.ERROR_DISK_FULL,
|
|
windows.ERROR_HANDLE_DISK_FULL,
|
|
)
|
|
}
|