From 94d951ff4ef322238bccd7091ed53566dd75ebdd Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 5 Oct 2026 00:42:45 +0000 Subject: [PATCH 1/4] Fix main CI failures in lint, vulns, and Windows The license check rejected smartware exec files that lacked the GPL header. govulncheck reached fzf before v0.73.1 and oras-go/v2 v2.6.1 through the OCI registry client. The Windows GUI build pinned tcell v3.6.5 and ebiten v2.7.5-ub.27, which predate the merged console and InitHint fixes, and CGO was off so tree-sitter could not compile. Bump those modules, build Windows with MinGW, and patch rune-go-sdk v0.2.0 in the Windows job because no published release compiles there. Co-authored-by: No Namegiven --- .github/workflows/test-windows.yml | 25 +++++++++- cmd/rune/main.go | 12 ++--- cmd/rune/platform_unix.go | 37 +++++++++++++++ cmd/rune/platform_windows.go | 36 +++++++++++++++ docs/windows-graphics.md | 31 ++++++++----- go.mod | 9 ++-- go.sum | 34 ++++---------- .../extension/extensionv2/workspace_runner.go | 3 +- internal/handler/search/util.go | 6 +++ internal/handler/search/util_test.go | 7 +++ internal/ide/idedebug/server.go | 4 +- internal/ide/idelsp/server.go | 17 +------ internal/ide/idelsp/socketpair_unix.go | 34 ++++++++++++++ internal/ide/idelsp/socketpair_windows.go | 27 +++++++++++ internal/procattr/procattr_unix.go | 43 +++++++++++++++++ internal/procattr/procattr_windows.go | 46 +++++++++++++++++++ internal/smartware/exec.go | 16 +++++++ internal/smartware/exec_test.go | 16 +++++++ internal/term/vte/component.go | 9 ++-- internal/workspace/file_scheme.go | 15 ++---- internal/workspace/proc_unix.go | 38 +++++++++++++++ internal/workspace/proc_windows.go | 38 +++++++++++++++ .../workspace/workspacerpc/command_stream.go | 4 +- .../workspace/workspacessh/sigmap_unix.go | 27 +++++++++++ internal/workspace/workspacessh/std_remote.go | 2 - scripts/rune-go-sdk-windows.patch | 43 +++++++++++++++++ 26 files changed, 489 insertions(+), 90 deletions(-) create mode 100644 cmd/rune/platform_unix.go create mode 100644 cmd/rune/platform_windows.go create mode 100644 internal/ide/idelsp/socketpair_unix.go create mode 100644 internal/ide/idelsp/socketpair_windows.go create mode 100644 internal/procattr/procattr_unix.go create mode 100644 internal/procattr/procattr_windows.go create mode 100644 internal/workspace/proc_unix.go create mode 100644 internal/workspace/proc_windows.go create mode 100644 internal/workspace/workspacessh/sigmap_unix.go create mode 100644 scripts/rune-go-sdk-windows.patch diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 7dfbc201b..49e404a36 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -28,11 +28,32 @@ jobs: go-version-file: go.mod cache: true + - name: Install MinGW + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + install: mingw-w64-x86_64-gcc + path-type: inherit + - name: Build GUI binary shell: bash run: | - GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \ - go build -tags=ebitensinglethread -o bin/rune.exe ./cmd/rune + gcc --version + go mod download github.com/unstablebuild/rune-go-sdk@v0.2.0 + mod="$(go env GOMODCACHE)/github.com/unstablebuild/rune-go-sdk@v0.2.0" + if command -v cygpath >/dev/null 2>&1; then + mod="$(cygpath -u "$mod")" + fi + client="$mod/api/workspaceapi/workspacerpc/client.go" + # rune-go-sdk v0.2.0 reads Unix-only SysProcAttr.Setsid/Setctty. + # No published release fixes that. Patch the module cache so the + # Windows compile can see those fields via reflection. + if ! grep -q 'func sessionFlags' "$client"; then + chmod -R u+w "$mod/api/workspaceapi/workspacerpc" + patch -d "$mod" -p1 --forward --batch < scripts/rune-go-sdk-windows.patch + fi + CGO_ENABLED=1 go build -tags=ebitensinglethread -o bin/rune.exe ./cmd/rune - name: Smoke test the built binary shell: bash diff --git a/cmd/rune/main.go b/cmd/rune/main.go index ad9e6465b..9d632f89d 100644 --- a/cmd/rune/main.go +++ b/cmd/rune/main.go @@ -46,7 +46,6 @@ import ( "github.com/unstablebuild/rune-go-sdk/api/workspaceapi" "github.com/unstablebuild/rune-go-sdk/term" "github.com/unstablebuild/rune-go-sdk/tui" - "golang.org/x/sys/unix" "google.golang.org/grpc" "unstable.build/rune/auth" "unstable.build/rune/cmd/rune/crashreport" @@ -228,9 +227,10 @@ func startWorkspaceServer() int { case syscall.SIGKILL: log.Info("Received SIGKILL signal: exiting") os.Exit(1) - case syscall.SIGURG: - /* received when socket urgent data is ready to be read */ default: + if ignoredSignal(sig) { + continue + } log.Debugf("Received unhandled signal: %#v", sig) } case <-quitch: @@ -350,11 +350,7 @@ func main() { logPath := crashreport.DefaultLaunchLogPath(*flagDataPath) f, err := os.OpenFile(logPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err == nil { - // syscall.Dup2 isn't defined on linux/arm64 (the - // kernel only exposes Dup3 there); golang.org/x/sys/unix - // papers over the difference. - fd := int(f.Fd()) - _ = unix.Dup2(fd, int(os.Stderr.Fd())) + _ = dupStderr(f) } flag.Parse() } diff --git a/cmd/rune/platform_unix.go b/cmd/rune/platform_unix.go new file mode 100644 index 000000000..2a178d150 --- /dev/null +++ b/cmd/rune/platform_unix.go @@ -0,0 +1,37 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build unix + +package main + +import ( + "os" + "syscall" + + "golang.org/x/sys/unix" +) + +func ignoredSignal(sig os.Signal) bool { + // Raised when socket urgent data is ready. It is not a shutdown. + return sig == syscall.SIGURG +} + +func dupStderr(f *os.File) error { + // syscall.Dup2 isn't defined on linux/arm64 (the kernel only exposes + // Dup3 there); golang.org/x/sys/unix papers over the difference. + return unix.Dup2(int(f.Fd()), int(os.Stderr.Fd())) +} diff --git a/cmd/rune/platform_windows.go b/cmd/rune/platform_windows.go new file mode 100644 index 000000000..7ce65eb87 --- /dev/null +++ b/cmd/rune/platform_windows.go @@ -0,0 +1,36 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build windows + +package main + +import ( + "os" + + "golang.org/x/sys/windows" +) + +func ignoredSignal(os.Signal) bool { + return false +} + +func dupStderr(f *os.File) error { + // Keep Go's os.Stderr and the process standard-error handle on the + // launch log. Windows has no dup2 in golang.org/x/sys/unix. + os.Stderr = f + return windows.SetStdHandle(windows.STD_ERROR_HANDLE, windows.Handle(f.Fd())) +} diff --git a/docs/windows-graphics.md b/docs/windows-graphics.md index 8db803266..0ec926672 100644 --- a/docs/windows-graphics.md +++ b/docs/windows-graphics.md @@ -15,22 +15,29 @@ non-Windows builds. ## Build -This branch includes a `go.work` that temporarily replaces: +`go.mod` pins the fork commits that contain the Windows fixes. Those +commits are on the upstream default branches and are not tagged yet: -- `github.com/hajimehoshi/ebiten/v2` -> `Bell8571/ebiten` @ `windows-inithint` ([unstablebuild/ebiten#1](https://github.com/unstablebuild/ebiten/pull/1)) -- `github.com/unstablebuild/tcell/v3` -> `Bell8571/tcell` @ `windows-console-screen` ([unstablebuild/tcell#6](https://github.com/unstablebuild/tcell/pull/6)) +- `github.com/hajimehoshi/ebiten/v2` -> `unstablebuild/ebiten` `v2.7.6-0.20260916232601-6f1d59169775` ([unstablebuild/ebiten#1](https://github.com/unstablebuild/ebiten/pull/1)), one commit after `v2.7.5-ub.32` +- `github.com/unstablebuild/tcell/v3` -> `v3.6.6-0.20260919122710-90d3af1d7f12` ([unstablebuild/tcell#6](https://github.com/unstablebuild/tcell/pull/6)), three commits after `v3.6.5` -```bash -GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -tags=ebitensinglethread -o rune.exe ./cmd/rune -``` - -Ebiten on Windows does not need CGO. Drop `go.work` (or its two replace -lines) once those PRs are merged and tagged. +`v2.7.5-ub.27` and `tcell` `v3.6.5` do not contain those fixes, so a +Windows GUI build fails in `ui_glfw.go` (`glfw.InitHint`) and +`console_win.go` (`cScreen`). -## Remaining upstream work +Tree-sitter is cgo, so the GUI binary needs a C compiler (`CGO_ENABLED=1`) +even though ebiten itself is built with `-tags=ebitensinglethread`. +`github.com/unstablebuild/rune-go-sdk@v0.2.0` also reads +`syscall.SysProcAttr.Setsid` and `Setctty`, which do not exist on +Windows and are not fixed in any published SDK tag. Apply +`scripts/rune-go-sdk-windows.patch` to that module before building. -1. [unstablebuild/ebiten#1](https://github.com/unstablebuild/ebiten/pull/1) — `glfw.InitHint` stub on Windows -2. [unstablebuild/tcell#6](https://github.com/unstablebuild/tcell/pull/6) — missing `Screen` methods on `cScreen` +```bash +go mod download github.com/unstablebuild/rune-go-sdk@v0.2.0 +mod="$(go env GOMODCACHE)/github.com/unstablebuild/rune-go-sdk@v0.2.0" +patch -d "$mod" -p1 < scripts/rune-go-sdk-windows.patch +CGO_ENABLED=1 go build -tags=ebitensinglethread -o rune.exe ./cmd/rune +``` Transparent themes (`gui.window_opacity`, `gui.window_blur_radius`) activate Mica on Windows 11 and Acrylic on Windows 10. diff --git a/go.mod b/go.mod index b4ecac88a..9d315643f 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/ernestrc/go-multierror v1.1.2 github.com/ernestrc/sensible v0.4.0 github.com/hajimehoshi/ebiten/v2 v2.7.4 - github.com/junegunn/fzf v0.0.0-20201216124428-ab3937ee5a62 + github.com/junegunn/fzf v0.73.1 github.com/mattn/go-runewidth v0.0.19 // indirect github.com/modelcontextprotocol/go-sdk v1.4.1 github.com/openai/openai-go/v2 v2.7.1 @@ -25,7 +25,7 @@ require ( github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.12.1 github.com/unstablebuild/rune-go-sdk v0.2.0 - github.com/unstablebuild/tcell/v3 v3.6.5 + github.com/unstablebuild/tcell/v3 v3.6.6-0.20260919122710-90d3af1d7f12 go.uber.org/goleak v1.3.0 golang.org/x/crypto v0.56.0 golang.org/x/image v0.45.0 @@ -82,7 +82,7 @@ require ( golang.org/x/oauth2 v0.36.0 google.golang.org/genai v1.59.0 mvdan.cc/sh/v3 v3.12.0 - oras.land/oras-go/v2 v2.6.1 + oras.land/oras-go/v2 v2.6.2 tailscale.com v1.102.3 ) @@ -168,6 +168,7 @@ require ( github.com/jezek/xgb v1.1.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jsimonetti/rtnetlink v1.4.1 // indirect + github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741 // indirect github.com/kevinburke/ssh_config v1.4.0 // indirect github.com/klauspost/compress v1.19.1 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect @@ -260,4 +261,4 @@ replace github.com/go-git/go-git/v6 => github.com/unstablebuild/go-git/v6 v6.0.1 replace github.com/tree-sitter/go-tree-sitter => github.com/unstablebuild/go-tree-sitter v0.25.0-ub.1 -replace github.com/hajimehoshi/ebiten/v2 => github.com/unstablebuild/ebiten/v2 v2.7.5-ub.27 +replace github.com/hajimehoshi/ebiten/v2 => github.com/unstablebuild/ebiten/v2 v2.7.6-0.20260916232601-6f1d59169775 diff --git a/go.sum b/go.sum index 55c4de9c7..27827ca7a 100644 --- a/go.sum +++ b/go.sum @@ -162,8 +162,6 @@ github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sa github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/gaissmai/bart v0.26.1 h1:+w4rnLGNlA2GDVn382Tfe3jOsK5vOr5n4KmigJ9lbTo= github.com/gaissmai/bart v0.26.1/go.mod h1:GREWQfTLRWz/c5FTOsIw+KkscuFkIV5t8Rp7Nd1Td5c= -github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0= github.com/gen2brain/malgo v0.11.24 h1:hHcIJVfzWcEDHFdPl5Dl/CUSOjzOleY0zzAV8Kx+imE= github.com/gen2brain/malgo v0.11.24/go.mod h1:f9TtuN7DVrXMiV/yIceMeWpvanyVzJQMlBecJFVMxww= github.com/github/fakeca v0.1.0 h1:Km/MVOFvclqxPM9dZBC4+QE564nU4gz4iZ0D9pMw28I= @@ -266,8 +264,10 @@ github.com/jsimonetti/rtnetlink v1.4.1 h1:JfD4jthWBqZMEffc5RjgmlzpYttAVw1sdnmiNa github.com/jsimonetti/rtnetlink v1.4.1/go.mod h1:xJjT7t59UIZ62GLZbv6PLLo8VFrostJMPBAheR6OM8w= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/junegunn/fzf v0.0.0-20201216124428-ab3937ee5a62 h1:6zc/t439xONeSlX0N4GF2UO2tUQYRBajMUixQM7rHB0= -github.com/junegunn/fzf v0.0.0-20201216124428-ab3937ee5a62/go.mod h1:ll79UTTxfoFrxzsOoQiz3cetZQPOsbXOqo2nxIfmkjA= +github.com/junegunn/fzf v0.73.1 h1:Ni9jaVMxsehcx9IwJ4ZAL/sr2c4dOEg1DHIAwPUVlyo= +github.com/junegunn/fzf v0.73.1/go.mod h1:hKDkO8orBWT5VLIZOL8oyhxn7mRLXdGyu+gz1Ss58pU= +github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741 h1:7dYDtfMDfKzjT+DVfIS4iqknSEKtZpEcXtu6vuaasHs= +github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741/go.mod h1:6EILKtGpo5t+KLb85LNZLAF6P9LKp78hJI80PXMcn3c= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v1.4.0 h1:6xxtP5bZ2E4NF5tuQulISpTO2z8XbtH8cg1PWkxoFkQ= @@ -287,7 +287,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag= github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -296,17 +295,13 @@ github.com/mark3labs/mcp-go v0.44.0 h1:OlYfcVviAnwNN40QZUrrzU0QZjq3En7rCU5X09a/B github.com/mark3labs/mcp-go v0.44.0/go.mod h1:YnJfOL382MIWDx1kMY+2zsRHU/q78dBg9aFb8W6Thdw= github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY= github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ= github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= -github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/mdlayher/genetlink v1.3.2 h1:KdrNKe+CTu+IbZnm/GVUMXSqBBLqcGpRDa0xkQy56gw= github.com/mdlayher/genetlink v1.3.2/go.mod h1:tcC3pkCrPUGIKKsCsp0B3AdaaKuHtaxoJRz3cc+528o= github.com/mdlayher/netlink v1.7.3-0.20250113171957-fbb4dce95f42 h1:A1Cq6Ysb0GM0tpKMbdCXCIfBclan4oHk1Jb+Hrejirg= @@ -401,7 +396,6 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/safchain/ethtool v0.3.0 h1:gimQJpsI6sc1yIqP/y8GYgiXn/NjgvpM0RNoWLVVmP0= github.com/safchain/ethtool v0.3.0/go.mod h1:SA9BwrgyAqNo7M+uaL6IYbxpm5wk3L7Mm6ocLW+CJUs= -github.com/saracen/walker v0.1.1/go.mod h1:0oKYMsKVhSJ+ful4p/XbjvXbMgLEkLITZaxozsl4CGE= github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= github.com/sebdah/goldie/v2 v2.5.3 h1:9ES/mNN+HNUbNWpVAlrzuZ7jE+Nrczbj8uFRjM7624Y= github.com/sebdah/goldie/v2 v2.5.3/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI= @@ -509,8 +503,8 @@ github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 h1:pyC9PaHYZFgEKFdlp3G8 github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA= github.com/unstablebuild/blue v1.84.1 h1:x62SNDMltzXwFJv9vSc/kYkE1xinCQGIniniJP9QJUU= github.com/unstablebuild/blue v1.84.1/go.mod h1:9yTwjlRwKO9rBPFiHCPb91jwM1GKf/+x5MJXS6tRN5I= -github.com/unstablebuild/ebiten/v2 v2.7.5-ub.27 h1:6jGCjs7KXe/N8IUo9PLUso24jqrG69qJgFPvmuQv/zw= -github.com/unstablebuild/ebiten/v2 v2.7.5-ub.27/go.mod h1:ktenNSafDcraZPupfeBBts/GZ9uP9oDbB4IXMJweNwk= +github.com/unstablebuild/ebiten/v2 v2.7.6-0.20260916232601-6f1d59169775 h1:E5DytgngYqXTV+bx0eySH4u/+gz7b5L/GHrqmakA4+s= +github.com/unstablebuild/ebiten/v2 v2.7.6-0.20260916232601-6f1d59169775/go.mod h1:ktenNSafDcraZPupfeBBts/GZ9uP9oDbB4IXMJweNwk= github.com/unstablebuild/go-billy/v6 v6.0.0-ub.1 h1:pPmxLsBLNuZv+LWeytIcvwzxeUAMYzeY2MDKmSWXMTA= github.com/unstablebuild/go-billy/v6 v6.0.0-ub.1/go.mod h1:E3VhlS+AKkrq6ZNn1axE2/nDRJ87l1FJk9r5HT2vPX0= github.com/unstablebuild/go-git/v6 v6.0.1-ub.1 h1:xBomYWGQkSIm023lhJxu+F1uU4YjZlIZaKpnm+7nIak= @@ -523,8 +517,8 @@ github.com/unstablebuild/pty v1.3.1 h1:GQSjqGKSOkOCu+X/F5yFUSuwp7Fi08xXn28DcuXhu github.com/unstablebuild/pty v1.3.1/go.mod h1:BpzWw5G39oyDqoJhusXyOiTk9/bsAblSD4Js9K462Pw= github.com/unstablebuild/rune-go-sdk v0.2.0 h1:EHRK5X6i58MQ2T7RQYCYKpeoO/JTpdNS03vHHOpp1iU= github.com/unstablebuild/rune-go-sdk v0.2.0/go.mod h1:NOvmmFvveXFC1AolJjwZfzA/EndgYoZ1fkt2RStmXsc= -github.com/unstablebuild/tcell/v3 v3.6.5 h1:ZokqnobK5xMQud8uqRI0PjcWWnlWb2zR5kyhrhMpuW4= -github.com/unstablebuild/tcell/v3 v3.6.5/go.mod h1:nfcmtlSfOVfBq07+ZeP4vcEmBRMDgYnPV1Yo67gORvw= +github.com/unstablebuild/tcell/v3 v3.6.6-0.20260919122710-90d3af1d7f12 h1:pDs3ZQ7083u6rmqQsOjbuUWXNur7fGG3vSUAbDVdUWI= +github.com/unstablebuild/tcell/v3 v3.6.6-0.20260919122710-90d3af1d7f12/go.mod h1:nfcmtlSfOVfBq07+ZeP4vcEmBRMDgYnPV1Yo67gORvw= github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY= github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= @@ -571,7 +565,6 @@ go4.org/mem v0.0.0-20240501181205-ae6ca9944745/go.mod h1:reUoABIJ9ikfM5sgtSF3Wus go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= @@ -596,7 +589,6 @@ golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -614,8 +606,6 @@ golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -626,12 +616,8 @@ golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -736,8 +722,8 @@ howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= mvdan.cc/sh/v3 v3.12.0 h1:ejKUR7ONP5bb+UGHGEG/k9V5+pRVIyD+LsZz7o8KHrI= mvdan.cc/sh/v3 v3.12.0/go.mod h1:Se6Cj17eYSn+sNooLZiEUnNNmNxg0imoYlTu4CyaGyg= -oras.land/oras-go/v2 v2.6.1 h1:bonOEkjLfp8tt6qXWRRWP6p1F+9octchOf2EqnWB4Zs= -oras.land/oras-go/v2 v2.6.1/go.mod h1:dhtFrFOuZuDtAVeZ9FUnaa5zfzplG3ZnFX9/uH1J/Yk= +oras.land/oras-go/v2 v2.6.2 h1:N04RXngAp1LJKTG6ifz3xHPipasEkWr+hFmInja5YKo= +oras.land/oras-go/v2 v2.6.2/go.mod h1:PlTtg4JTDJkDe8yVHpM2wz7/YDc00GVas+i4jAW2TZ4= software.sslmate.com/src/go-pkcs12 v0.4.0 h1:H2g08FrTvSFKUj+D309j1DPfk5APnIdAQAB8aEykJ5k= software.sslmate.com/src/go-pkcs12 v0.4.0/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI= tailscale.com v1.102.3 h1:M1czCAtMuIcg+2Z+FBPbJyAk3ZEQGEFKnvHthtE1c6M= diff --git a/internal/extension/extensionv2/workspace_runner.go b/internal/extension/extensionv2/workspace_runner.go index dad401042..35d8cf116 100644 --- a/internal/extension/extensionv2/workspace_runner.go +++ b/internal/extension/extensionv2/workspace_runner.go @@ -44,6 +44,7 @@ import ( "unstable.build/rune/internal/debug" "unstable.build/rune/internal/extension" "unstable.build/rune/internal/ide/ideauthorizer" + "unstable.build/rune/internal/procattr" "unstable.build/rune/internal/workspace" "unstable.build/rune/internal/workspace/processctx" ) @@ -313,7 +314,7 @@ func (m *workspaceRunner) makeCommand( // `cargo run`, which exec the extension as a grandchild that // SIGKILL cannot be forwarded to. Heading its own process // group is what lets stopping the extension reach it. - SysProcAttr: &syscall.SysProcAttr{Setpgid: true}, + SysProcAttr: procattr.ProcessGroup(), } // if local workspace, then do set dir in a best effort for diff --git a/internal/handler/search/util.go b/internal/handler/search/util.go index e77828aaf..7aac353ce 100644 --- a/internal/handler/search/util.go +++ b/internal/handler/search/util.go @@ -28,6 +28,12 @@ const ( slab32Size int = 2048 // 8KB * 32 = 256KB ) +func init() { + // fzf fills the ASCII class and bonus tables in Init, not package init. + // Without that, case-insensitive fuzzy match does not fold capitals. + fzf.Init("default") +} + // Match represents a search match. type Match struct { idx int diff --git a/internal/handler/search/util_test.go b/internal/handler/search/util_test.go index 6ba709ab1..fad2e7e71 100644 --- a/internal/handler/search/util_test.go +++ b/internal/handler/search/util_test.go @@ -111,6 +111,13 @@ func TestSearch(t *testing.T) { } } +func TestFuzzyCaseInsensitiveFoldsASCII(t *testing.T) { + matches := Fuzzy([][]byte{[]byte("X Files"), []byte("capitol")}, "x", false) + if assert.Len(t, matches, 1) { + assert.Equal(t, "X Files", string(matches[0].Data())) + } +} + func benchSearch(b *testing.B, n int) { slab := util.MakeSlab(slab16Size, slab32Size) algo := fzf.FuzzyMatchV2 diff --git a/internal/ide/idedebug/server.go b/internal/ide/idedebug/server.go index 9563a2791..ba0a9ba16 100644 --- a/internal/ide/idedebug/server.go +++ b/internal/ide/idedebug/server.go @@ -26,7 +26,6 @@ import ( "strings" "sync" "sync/atomic" - "syscall" "time" "github.com/google/go-dap" @@ -34,6 +33,7 @@ import ( "github.com/unstablebuild/rune-go-sdk/api/schemeapi" "github.com/unstablebuild/rune-go-sdk/api/workspaceapi" "unstable.build/rune/internal/debug" + "unstable.build/rune/internal/procattr" "unstable.build/rune/internal/workspace/processctx" ) @@ -151,7 +151,7 @@ func (s *debugServer) start(ctx context.Context) error { // the adapter as a grandchild, and they spawn the debuggee in // turn. Heading its own process group is what lets ending the // session tear the whole tree down. - SysProcAttr: &syscall.SysProcAttr{Setpgid: true}, + SysProcAttr: procattr.ProcessGroup(), } // Do not use ctx for lifecycle cancellation: it is scoped to the initial diff --git a/internal/ide/idelsp/server.go b/internal/ide/idelsp/server.go index 83e15e601..596a9df69 100644 --- a/internal/ide/idelsp/server.go +++ b/internal/ide/idelsp/server.go @@ -26,13 +26,13 @@ import ( "os" "slices" "sync" - "syscall" "time" "github.com/unstablebuild/rune-go-sdk/api/schemeapi" "github.com/unstablebuild/rune-go-sdk/api/semanticapi" "github.com/unstablebuild/rune-go-sdk/api/workspaceapi" "unstable.build/rune/internal/ide/idelsp/jsonrpc2" + "unstable.build/rune/internal/procattr" "unstable.build/rune/internal/workspace/processctx" ) @@ -141,19 +141,6 @@ type deadlineWriter struct { conn net.Conn } -func lspSocketpair() ([2]int, error) { - syscall.ForkLock.Lock() - defer syscall.ForkLock.Unlock() - - fds, err := syscall.Socketpair(syscall.AF_UNIX, syscall.SOCK_STREAM, 0) - if err != nil { - return fds, err - } - syscall.CloseOnExec(fds[0]) - syscall.CloseOnExec(fds[1]) - return fds, nil -} - func (w *deadlineWriter) Write(ctx context.Context, msg jsonrpc2.Message) error { if deadline, ok := ctx.Deadline(); ok { if err := w.conn.SetWriteDeadline(deadline); err != nil { @@ -218,7 +205,7 @@ func (s *langServer) start(ctx context.Context) error { // telemetry child), and some are reached through a launcher // that execs the server as a grandchild. Heading its own // process group is what lets stopping the server reach them. - SysProcAttr: &syscall.SysProcAttr{Setpgid: true}, + SysProcAttr: procattr.ProcessGroup(), } // Do not use ctx for lifecycle cancellation: it is scoped to the initial diff --git a/internal/ide/idelsp/socketpair_unix.go b/internal/ide/idelsp/socketpair_unix.go new file mode 100644 index 000000000..87859acb6 --- /dev/null +++ b/internal/ide/idelsp/socketpair_unix.go @@ -0,0 +1,34 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build unix + +package idelsp + +import "syscall" + +func lspSocketpair() ([2]int, error) { + syscall.ForkLock.Lock() + defer syscall.ForkLock.Unlock() + + fds, err := syscall.Socketpair(syscall.AF_UNIX, syscall.SOCK_STREAM, 0) + if err != nil { + return fds, err + } + syscall.CloseOnExec(fds[0]) + syscall.CloseOnExec(fds[1]) + return fds, nil +} diff --git a/internal/ide/idelsp/socketpair_windows.go b/internal/ide/idelsp/socketpair_windows.go new file mode 100644 index 000000000..34ec05f98 --- /dev/null +++ b/internal/ide/idelsp/socketpair_windows.go @@ -0,0 +1,27 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build windows + +package idelsp + +import "errors" + +func lspSocketpair() ([2]int, error) { + // syscall.Socketpair and ForkLock are Unix-only. Language servers on + // Windows need a different stdio transport; the GUI binary still builds. + return [2]int{}, errors.New("lsp socketpair is not supported on windows") +} diff --git a/internal/procattr/procattr_unix.go b/internal/procattr/procattr_unix.go new file mode 100644 index 000000000..391b72296 --- /dev/null +++ b/internal/procattr/procattr_unix.go @@ -0,0 +1,43 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build unix + +// Package procattr builds syscall.SysProcAttr values that stay compilable +// on platforms whose process model does not have POSIX session fields. +package procattr + +import "syscall" + +// ProcessGroup starts the child as the leader of a new process group. +func ProcessGroup() *syscall.SysProcAttr { + return &syscall.SysProcAttr{Setpgid: true} +} + +// Session makes the child a session leader with a controlling terminal. +func Session() *syscall.SysProcAttr { + return &syscall.SysProcAttr{Setsid: true, Setctty: true} +} + +// SessionFlags applies the requested session and controlling-tty flags. +func SessionFlags(setsid, setctty bool) *syscall.SysProcAttr { + return &syscall.SysProcAttr{Setsid: setsid, Setctty: setctty} +} + +// LeadsGroup reports whether attr asks the child to head a new process group. +func LeadsGroup(attr *syscall.SysProcAttr) bool { + return attr != nil && attr.Setpgid && attr.Pgid == 0 +} diff --git a/internal/procattr/procattr_windows.go b/internal/procattr/procattr_windows.go new file mode 100644 index 000000000..b6b73fe78 --- /dev/null +++ b/internal/procattr/procattr_windows.go @@ -0,0 +1,46 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build windows + +// Package procattr builds syscall.SysProcAttr values that stay compilable +// on platforms whose process model does not have POSIX session fields. +package procattr + +import "syscall" + +// ProcessGroup is a no-op attribute on Windows. POSIX process groups are +// not part of syscall.SysProcAttr there. +func ProcessGroup() *syscall.SysProcAttr { + return &syscall.SysProcAttr{} +} + +// Session is a no-op attribute on Windows. Setsid and Setctty do not exist +// on syscall.SysProcAttr there. +func Session() *syscall.SysProcAttr { + return &syscall.SysProcAttr{} +} + +// SessionFlags is a no-op attribute on Windows. +func SessionFlags(_, _ bool) *syscall.SysProcAttr { + return &syscall.SysProcAttr{} +} + +// LeadsGroup is always false on Windows: SysProcAttr cannot express a +// POSIX process-group leader. +func LeadsGroup(*syscall.SysProcAttr) bool { + return false +} diff --git a/internal/smartware/exec.go b/internal/smartware/exec.go index c3a6830a6..cbb149b8b 100644 --- a/internal/smartware/exec.go +++ b/internal/smartware/exec.go @@ -1,3 +1,19 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + package smartware import ( diff --git a/internal/smartware/exec_test.go b/internal/smartware/exec_test.go index 18363320a..4282e5619 100644 --- a/internal/smartware/exec_test.go +++ b/internal/smartware/exec_test.go @@ -1,3 +1,19 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + package smartware import ( diff --git a/internal/term/vte/component.go b/internal/term/vte/component.go index 109a3e395..8a6f82e4d 100644 --- a/internal/term/vte/component.go +++ b/internal/term/vte/component.go @@ -23,7 +23,6 @@ import ( "strings" "sync" "sync/atomic" - "syscall" "time" log "github.com/sirupsen/logrus" @@ -38,6 +37,7 @@ import ( "unstable.build/rune/internal/cell" "unstable.build/rune/internal/component" "unstable.build/rune/internal/debug" + "unstable.build/rune/internal/procattr" "unstable.build/rune/internal/term/vte/vteparser" "unstable.build/rune/internal/text" ) @@ -960,11 +960,8 @@ func (t *Component) startCommand(ctx context.Context, cmdAndArgsStr string) erro } t.log(log.DebugLevel, "creating pty with cmdAndArgs: %#v", cmdAndArgs) cmd := workspaceapi.Cmd{ - SysProcAttr: &syscall.SysProcAttr{ - Setsid: true, - Setctty: true, - }, - Watcher: t.watcher, + SysProcAttr: procattr.Session(), + Watcher: t.watcher, } cmd.Env = appendDefaultTerminalEnv(cmd.Env) // When the user hasn't configured a CommandAndArgs, leave diff --git a/internal/workspace/file_scheme.go b/internal/workspace/file_scheme.go index 42a3a3816..91dca5363 100644 --- a/internal/workspace/file_scheme.go +++ b/internal/workspace/file_scheme.go @@ -43,6 +43,7 @@ import ( "github.com/unstablebuild/rune-go-sdk/api/workspaceapi" "unstable.build/rune/internal/debug" "unstable.build/rune/internal/gitenv" + "unstable.build/rune/internal/procattr" ) const ( @@ -429,8 +430,7 @@ func (p *fileScheme) StartCommand(ctx context.Context, cmd workspaceapi.Cmd) ( // `go run` exec the real program as a grandchild that SIGKILL // cannot be forwarded to. Joining an existing Pgid is someone // else's group and not ours to signal. - attr := cmd.SysProcAttr - leadsGroup := attr != nil && attr.Setpgid && attr.Pgid == 0 + leadsGroup := procattr.LeadsGroup(cmd.SysProcAttr) if leadsGroup { stdcmd.Cancel = func() error { return killProcessGroup(stdcmd.Process) } } @@ -518,22 +518,13 @@ func (p *fileScheme) Signal(pid workspaceapi.Pid, signal syscall.Signal) error { return errProcNotFound } - err := syscall.Kill(int(pid), signal) + err := signalPid(int(pid), signal) if err != nil { return fmt.Errorf("syscall kill: %w", err) } return nil } -// killProcessGroup terminates every process in the group led by proc. -func killProcessGroup(proc *os.Process) error { - err := syscall.Kill(-proc.Pid, syscall.SIGKILL) - if errors.Is(err, syscall.ESRCH) { - return os.ErrProcessDone - } - return err -} - func (p *fileScheme) NewPty(ctx context.Context) (workspaceapi.Pty, error) { // open master/slave files pty, tty, err := pty.Open() diff --git a/internal/workspace/proc_unix.go b/internal/workspace/proc_unix.go new file mode 100644 index 000000000..2cf144687 --- /dev/null +++ b/internal/workspace/proc_unix.go @@ -0,0 +1,38 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build unix + +package workspace + +import ( + "errors" + "os" + "syscall" +) + +func signalPid(pid int, signal syscall.Signal) error { + return syscall.Kill(pid, signal) +} + +// killProcessGroup terminates every process in the group led by proc. +func killProcessGroup(proc *os.Process) error { + err := syscall.Kill(-proc.Pid, syscall.SIGKILL) + if errors.Is(err, syscall.ESRCH) { + return os.ErrProcessDone + } + return err +} diff --git a/internal/workspace/proc_windows.go b/internal/workspace/proc_windows.go new file mode 100644 index 000000000..73f07a9a8 --- /dev/null +++ b/internal/workspace/proc_windows.go @@ -0,0 +1,38 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build windows + +package workspace + +import ( + "os" + "syscall" +) + +func signalPid(pid int, signal syscall.Signal) error { + proc, err := os.FindProcess(pid) + if err != nil { + return err + } + return proc.Signal(signal) +} + +// killProcessGroup terminates proc. Windows syscall has no negative-pid +// group kill. +func killProcessGroup(proc *os.Process) error { + return proc.Kill() +} diff --git a/internal/workspace/workspacerpc/command_stream.go b/internal/workspace/workspacerpc/command_stream.go index 4e7a6de62..ba966233b 100644 --- a/internal/workspace/workspacerpc/command_stream.go +++ b/internal/workspace/workspacerpc/command_stream.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" "io" - "syscall" multierr "github.com/ernestrc/go-multierror" log "github.com/sirupsen/logrus" @@ -31,6 +30,7 @@ import ( "github.com/unstablebuild/rune-go-sdk/api/workspaceapi" "github.com/unstablebuild/rune-go-sdk/api/workspaceapi/workspacerpc" "unstable.build/rune/internal/debug" + "unstable.build/rune/internal/procattr" ) type serverCommandStreamer struct { @@ -69,7 +69,7 @@ func newServerCommandStreamer( Watcher: workspaceapi.ChanProcessWatcher(doneCh), } if setsid || setctty { - cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: setsid, Setctty: setctty} + cmd.SysProcAttr = procattr.SessionFlags(setsid, setctty) } ret := new(serverCommandStreamer) diff --git a/internal/workspace/workspacessh/sigmap_unix.go b/internal/workspace/workspacessh/sigmap_unix.go new file mode 100644 index 000000000..cf431cbcf --- /dev/null +++ b/internal/workspace/workspacessh/sigmap_unix.go @@ -0,0 +1,27 @@ +// Copyright (C) 2017-2026 The Rune Authors +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//go:build unix + +package workspacessh + +import "syscall" + +func init() { + // SIGUSR1 and SIGUSR2 are not defined in the Windows syscall package. + sigMap[syscall.SIGUSR1] = "USR1" + sigMap[syscall.SIGUSR2] = "USR2" +} diff --git a/internal/workspace/workspacessh/std_remote.go b/internal/workspace/workspacessh/std_remote.go index 2cb68ed46..5514c266c 100644 --- a/internal/workspace/workspacessh/std_remote.go +++ b/internal/workspace/workspacessh/std_remote.go @@ -184,8 +184,6 @@ var sigMap = map[syscall.Signal]ssh.Signal{ syscall.SIGQUIT: "QUIT", syscall.SIGSEGV: "SEGV", syscall.SIGTERM: "TERM", - syscall.SIGUSR1: "USR1", - syscall.SIGUSR2: "USR2", } // used to adapt ssh.Client to sshClient diff --git a/scripts/rune-go-sdk-windows.patch b/scripts/rune-go-sdk-windows.patch new file mode 100644 index 000000000..b83122b14 --- /dev/null +++ b/scripts/rune-go-sdk-windows.patch @@ -0,0 +1,43 @@ +--- a/api/workspaceapi/workspacerpc/client.go ++++ b/api/workspaceapi/workspacerpc/client.go +@@ -22,6 +22,7 @@ + "log/slog" + "os" + "path/filepath" ++ "reflect" + "syscall" + "time" + +@@ -286,11 +287,7 @@ + cancelFn() + return 0, fmt.Errorf("new stream: %v", err) + } +- var setsid, setctty bool +- if cmd.SysProcAttr != nil { +- setsid = cmd.SysProcAttr.Setsid +- setctty = cmd.SysProcAttr.Setctty +- } ++ setsid, setctty := sessionFlags(cmd.SysProcAttr) + req := CommandPayload{ + Type: CommandPayload_TypeStart, + Start: &StartCommandRequest{ +@@ -622,3 +619,19 @@ + context.AfterFunc(ctx2, cancel) + return ctx, cancel + } ++ ++// sessionFlags reads Setsid and Setctty when those fields exist. ++// Windows syscall.SysProcAttr does not have them; direct references do not compile. ++func sessionFlags(attr *syscall.SysProcAttr) (setsid, setctty bool) { ++ if attr == nil { ++ return false, false ++ } ++ v := reflect.ValueOf(attr).Elem() ++ if f := v.FieldByName("Setsid"); f.IsValid() && f.Kind() == reflect.Bool { ++ setsid = f.Bool() ++ } ++ if f := v.FieldByName("Setctty"); f.IsValid() && f.Kind() == reflect.Bool { ++ setctty = f.Bool() ++ } ++ return setsid, setctty ++} From c91ee2007f7f3142e5e01b720ecd126d8b62cd06 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 5 Oct 2026 00:56:38 +0000 Subject: [PATCH 2/4] Fix Windows file URIs so rune --version can start CurrentUserHostURI and the local file scheme built file://D:\... which url.Parse treats as a host plus an invalid port. Drive paths now use an empty host, and the Windows job applies that SDK fix before the smoke test. Co-authored-by: No Namegiven --- .github/workflows/test-windows.yml | 6 +++--- docs/windows-graphics.md | 10 ++++++---- internal/workspace/file_scheme.go | 8 ++++++-- internal/workspace/file_scheme_test.go | 13 +++++++++++++ scripts/rune-go-sdk-windows.patch | 18 ++++++++++++++++++ 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 49e404a36..fc37b2c73 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -46,9 +46,9 @@ jobs: mod="$(cygpath -u "$mod")" fi client="$mod/api/workspaceapi/workspacerpc/client.go" - # rune-go-sdk v0.2.0 reads Unix-only SysProcAttr.Setsid/Setctty. - # No published release fixes that. Patch the module cache so the - # Windows compile can see those fields via reflection. + # rune-go-sdk v0.2.0 reads Unix-only SysProcAttr.Setsid/Setctty + # and parses D:\ paths as file-URL hosts. No published release + # fixes either. Patch the module cache before compiling. if ! grep -q 'func sessionFlags' "$client"; then chmod -R u+w "$mod/api/workspaceapi/workspacerpc" patch -d "$mod" -p1 --forward --batch < scripts/rune-go-sdk-windows.patch diff --git a/docs/windows-graphics.md b/docs/windows-graphics.md index 0ec926672..0b8eb23be 100644 --- a/docs/windows-graphics.md +++ b/docs/windows-graphics.md @@ -27,10 +27,12 @@ Windows GUI build fails in `ui_glfw.go` (`glfw.InitHint`) and Tree-sitter is cgo, so the GUI binary needs a C compiler (`CGO_ENABLED=1`) even though ebiten itself is built with `-tags=ebitensinglethread`. -`github.com/unstablebuild/rune-go-sdk@v0.2.0` also reads -`syscall.SysProcAttr.Setsid` and `Setctty`, which do not exist on -Windows and are not fixed in any published SDK tag. Apply -`scripts/rune-go-sdk-windows.patch` to that module before building. +`github.com/unstablebuild/rune-go-sdk@v0.2.0` does not build or start +on Windows as published: `workspacerpc` reads Unix-only +`SysProcAttr.Setsid` and `Setctty`, and `CurrentUserHostURI` turns +`D:\...` into a `file://` URL whose drive letter is a host. No published +SDK tag fixes either. Apply `scripts/rune-go-sdk-windows.patch` to that +module before building. ```bash go mod download github.com/unstablebuild/rune-go-sdk@v0.2.0 diff --git a/internal/workspace/file_scheme.go b/internal/workspace/file_scheme.go index 91dca5363..894492045 100644 --- a/internal/workspace/file_scheme.go +++ b/internal/workspace/file_scheme.go @@ -752,8 +752,12 @@ func (f *ownedSchemeFile) Close() error { } func makeLocalURI(path string) (workspaceapi.URI, error) { - uriStr := "file://" + path - return workspaceapi.ParseURI(uriStr) + // Same shape as the SDK helper: Windows drive paths are not hostnames. + slash := filepath.ToSlash(path) + if !strings.HasPrefix(slash, "/") { + slash = "/" + slash + } + return workspaceapi.ParseURI("file://" + slash) } func (p *fileScheme) tryUnwrapFileWriter(f io.Writer) io.Writer { diff --git a/internal/workspace/file_scheme_test.go b/internal/workspace/file_scheme_test.go index 27734257e..f3345a722 100644 --- a/internal/workspace/file_scheme_test.go +++ b/internal/workspace/file_scheme_test.go @@ -1071,3 +1071,16 @@ func TestFileSchemeStartCommandScrubsGitHookEnv(t *testing.T) { assert.Contains(t, env, "CALLER_VAR=explicit", "caller-provided cmd.Env must still pass through") } + +func TestMakeLocalURI(t *testing.T) { + unixURI, err := makeLocalURI("/tmp/rune") + require.NoError(t, err) + assert.Empty(t, unixURI.Hostname()) + assert.Equal(t, "/tmp/rune", unixURI.Path()) + + // A drive path must not be parsed as a host plus an invalid port. + driveURI, err := makeLocalURI("D:/a/rune/rune") + require.NoError(t, err) + assert.Empty(t, driveURI.Hostname()) + assert.Equal(t, "/D:/a/rune/rune", driveURI.Path()) +} diff --git a/scripts/rune-go-sdk-windows.patch b/scripts/rune-go-sdk-windows.patch index b83122b14..a8b20bc25 100644 --- a/scripts/rune-go-sdk-windows.patch +++ b/scripts/rune-go-sdk-windows.patch @@ -41,3 +41,21 @@ + } + return setsid, setctty +} +--- a/api/workspaceapi/uri.go ++++ b/api/workspaceapi/uri.go +@@ -271,8 +271,13 @@ + } + + func makeLocalURI(path string) (URI, error) { +- uriStr := "file://" + path +- u, err := url.Parse(uriStr) ++ // Absolute Windows paths do not start with a slash, so "file://" + path ++ // treats the drive letter as a host. Force an empty host and slash separators. ++ slash := filepath.ToSlash(path) ++ if !strings.HasPrefix(slash, "/") { ++ slash = "/" + slash ++ } ++ u, err := url.Parse("file://" + slash) + if err != nil { + return URI{}, err + } From e9480a7befc8953c3d8b4e775c36453e1405ac04 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 5 Oct 2026 01:06:26 +0000 Subject: [PATCH 3/4] Fix Windows drive URIs so file schemes can stat them file:///D:/a/rune parses to the path /D:/a/rune, which CreateFile rejects as \D:\a\rune. Drop that extra slash so the stored path is an OS path the file scheme can open. Co-authored-by: No Namegiven --- internal/workspace/file_scheme.go | 13 +++++++++++-- internal/workspace/file_scheme_test.go | 2 +- scripts/rune-go-sdk-windows.patch | 12 ++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/internal/workspace/file_scheme.go b/internal/workspace/file_scheme.go index 894492045..9c9a175ae 100644 --- a/internal/workspace/file_scheme.go +++ b/internal/workspace/file_scheme.go @@ -752,12 +752,21 @@ func (f *ownedSchemeFile) Close() error { } func makeLocalURI(path string) (workspaceapi.URI, error) { - // Same shape as the SDK helper: Windows drive paths are not hostnames. + // Windows drive paths are not URL hosts. Parse with an empty host, then + // drop the extra slash so the stored path is an OS path. slash := filepath.ToSlash(path) if !strings.HasPrefix(slash, "/") { slash = "/" + slash } - return workspaceapi.ParseURI("file://" + slash) + uri, err := workspaceapi.ParseURI("file://" + slash) + if err != nil { + return uri, err + } + p := uri.Path() + if len(p) >= 3 && p[0] == '/' && p[2] == ':' { + return workspaceapi.WithPath(uri, p[1:]) + } + return uri, nil } func (p *fileScheme) tryUnwrapFileWriter(f io.Writer) io.Writer { diff --git a/internal/workspace/file_scheme_test.go b/internal/workspace/file_scheme_test.go index f3345a722..eda042276 100644 --- a/internal/workspace/file_scheme_test.go +++ b/internal/workspace/file_scheme_test.go @@ -1082,5 +1082,5 @@ func TestMakeLocalURI(t *testing.T) { driveURI, err := makeLocalURI("D:/a/rune/rune") require.NoError(t, err) assert.Empty(t, driveURI.Hostname()) - assert.Equal(t, "/D:/a/rune/rune", driveURI.Path()) + assert.Equal(t, "D:/a/rune/rune", driveURI.Path()) } diff --git a/scripts/rune-go-sdk-windows.patch b/scripts/rune-go-sdk-windows.patch index a8b20bc25..b558fd78b 100644 --- a/scripts/rune-go-sdk-windows.patch +++ b/scripts/rune-go-sdk-windows.patch @@ -43,14 +43,15 @@ +} --- a/api/workspaceapi/uri.go +++ b/api/workspaceapi/uri.go -@@ -271,8 +271,13 @@ +@@ -271,12 +271,20 @@ } func makeLocalURI(path string) (URI, error) { - uriStr := "file://" + path - u, err := url.Parse(uriStr) + // Absolute Windows paths do not start with a slash, so "file://" + path -+ // treats the drive letter as a host. Force an empty host and slash separators. ++ // treats the drive letter as a host. Force an empty host, then drop the ++ // extra slash so Path() is an OS path (D:/a/rune, not /D:/a/rune). + slash := filepath.ToSlash(path) + if !strings.HasPrefix(slash, "/") { + slash = "/" + slash @@ -59,3 +60,10 @@ if err != nil { return URI{}, err } +- ++ if len(u.Path) >= 3 && u.Path[0] == '/' && u.Path[2] == ':' { ++ u.Path = u.Path[1:] ++ } + return makeFileURI(u) + } + From e24410d02b8fcfc5bbf6ee2992a69a13c2c8e917 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 5 Oct 2026 01:39:24 +0000 Subject: [PATCH 4/4] Fix Linux CI so a codecov TLS error does not fail the job The test suite passed. codecov-action still exited 1 on an SSL handshake failure even with fail_ci_if_error set to false, which failed the Linux workflow. Keep that upload from failing the job. Co-authored-by: No Namegiven --- .github/workflows/test-linux.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 105c0d442..8cd4107ed 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -44,6 +44,10 @@ jobs: GOTESTFLAGS='-race -timeout 300s -p 1 -coverprofile=coverage.out' - uses: codecov/codecov-action@v4 + # The action still exits 1 on a TLS handshake failure to the upload + # host even when fail_ci_if_error is false. Coverage upload is not + # the test gate; the Test step above is. + continue-on-error: true with: files: coverage.out token: ${{ secrets.CODECOV_TOKEN }}