Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Build the tree for Windows and name the platform seams

215f8aebc38e69e621eb6f739e0cfea2ba07fd9a · Keenan Nemetz · 2d ago · parent 416739b1

Build the tree for Windows and name the platform seams

`go build` for windows/amd64 failed on five unix syscall uses, and the tree had
nowhere to say what a platform can and cannot do. Each unix-only site now lives
in a `_unix.go` file with a Windows counterpart: disk capacity through
GetDiskFreeSpaceEx, allocated bytes through GetCompressedFileSize, hard-link
identity through GetFileInformationByHandle, the runner's cache lock through
LockFileEx, a liveness probe through OpenProcess, and a command's process group
through a helper that has no group to signal yet.

Two sites cannot be ported without weakening them, so they refuse rather than
pretend. File modes are a unix control and Windows needs ACLs instead, so
`internal/secure` will not create or accept a secret there, and `internal/audit`
will not verify a log it cannot check. The front door says the same about exec,
which Windows does not have: sshd gets an explanation instead of a process that
returns EWINDOWS.

A CI step cross-compiles windows/amd64 and vets it, and `go vet` is what
type-checks the test files that `go build` skips, so a unix-only call fails a
push instead of a port nobody can start.

Part of 01M8S9B86B36PE0MY8MMCRCMYA.

ci/agent/disk.go +2−16

@@ -5,22 +5,8 @@ package agent
5 5 // A job's workspace is a bind mount from the host: the runtime cannot quota it, and a
6 6 // filesystem quota there would need root and a filesystem that supports one. What the
7 7 // runner can promise is that it notices, so a job that writes without a bound costs
8 // that job instead of the machine. The reserve is one statfs on the filesystem holding
9 // --dir, checked while a command runs, and reported with the numbers.
10
11 import (
12 "syscall"
13 )
14
15 // freeBytes reports how many bytes are available to this user on the filesystem
16 // holding dir.
17 func freeBytes(dir string) (int64, error) {
18 var st syscall.Statfs_t
19 if err := syscall.Statfs(dir, &st); err != nil {
20 return 0, err
21 }
22 return int64(st.Bavail) * int64(st.Bsize), nil
23 }
8 // that job instead of the machine. The reserve is one query of the filesystem holding --dir,
9 // checked while a command runs, and reported with the numbers.
24 10
25 11 // diskLow reports whether the filesystem holding dir has less than reserve bytes
26 12 // free. A reserve of zero disables the check, which is what a runner whose --dir is