提交记录修改.github/workflows/linux-build.yml+2 −2看文件
修改internal/workbench/claude_desktop_resize_unix_test.go+11 −5看文件
修改scripts/guest-os/setup-windows-guest.ps1+2 −0看文件
修改scripts/guest-os/windows-iso-setup.tests.ps1+1 −0看文件
| @@ -29,12 +29,12 @@ jobs: | ||
| 29 | 29 | image: ubuntu:22.04 |
| 30 | 30 | # docker-default AppArmor denies bubblewrap's private mount namespace. |
| 31 | 31 | # Relax only this disposable outer container; WebKit keeps its sandbox. |
| 32 | 删除: options: --security-opt seccomp=unconfined --security-opt systempaths=unconfined --security-opt apparmor=unconfined | |
| 32 | 新增: options: --init --security-opt seccomp=unconfined --security-opt systempaths=unconfined --security-opt apparmor=unconfined | |
| 33 | 33 | steps: |
| 34 | 34 | - name: Install build and test dependencies |
| 35 | 35 | run: | |
| 36 | 36 | apt-get update |
| 37 | 删除: DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev libjson-glib-dev dpkg-dev curl ca-certificates git software-properties-common qemu-system-x86 qemu-utils ovmf openssh-client iproute2 dbus-x11 xvfb xauth fonts-noto-cjk zsh sudo | |
| 37 | 新增: DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev libjson-glib-dev dpkg-dev curl ca-certificates git software-properties-common qemu-system-x86 qemu-utils ovmf openssh-client iproute2 dbus-x11 xvfb xauth fonts-noto-cjk zsh sudo tzdata | |
| 38 | 38 | # The supported 22.04 ABI predates safe.bareRepository. Use the Git |
| 39 | 39 | # project's documented Ubuntu packages, preserving the runtime gate. |
| 40 | 40 | add-apt-repository -y ppa:git-core/ppa |
| @@ -18,10 +18,15 @@ func TestDesktopResizeScriptAppliesTheViewersDensity(t *testing.T) { | ||
| 18 | 18 | if runtime.GOOS != "linux" || err != nil { |
| 19 | 19 | t.Skip("the script identifies its settings manager through /proc") |
| 20 | 20 | } |
| 21 | 删除: // Go's temporary directory can be mounted noexec; the stand-ins must run. | |
| 22 | 删除: root, err := os.MkdirTemp("/dev/shm", "cage-resize-") | |
| 21 | 新增: // go test already executes its test binary from this filesystem. Both | |
| 22 | 新增: // TMPDIR and /dev/shm can be mounted noexec independently of the Go build directory. | |
| 23 | 新增: executable, err := os.Executable() | |
| 23 | 24 | if err != nil { |
| 24 | 删除: root = t.TempDir() | |
| 25 | 新增: t.Fatal(err) | |
| 26 | 新增: } | |
| 27 | 新增: root, err := os.MkdirTemp(filepath.Dir(executable), "cage-resize-") | |
| 28 | 新增: if err != nil { | |
| 29 | 新增: t.Fatal(err) | |
| 25 | 30 | } |
| 26 | 31 | t.Cleanup(func() { os.RemoveAll(root) }) |
| 27 | 32 | desktop, phone, bin := filepath.Join(root, "desktop"), filepath.Join(root, "phone"), filepath.Join(root, "bin") |
| @@ -40,9 +45,10 @@ func TestDesktopResizeScriptAppliesTheViewersDensity(t *testing.T) { | ||
| 40 | 45 | data, _ := os.ReadFile(path) |
| 41 | 46 | return string(data) |
| 42 | 47 | } |
| 43 | 删除: write(filepath.Join(bin, "xrandr"), "#!/bin/sh\necho \"$*\" >> "+filepath.Join(root, "modes")+"\n", 0o700) | |
| 48 | 新增: t.Setenv("CAGE_RESIZE_FIXTURE", root) | |
| 49 | 新增: write(filepath.Join(bin, "xrandr"), "#!/bin/sh\necho \"$*\" >> \"$CAGE_RESIZE_FIXTURE/modes\"\n", 0o700) | |
| 44 | 50 | // The script signals a process named xsettingsd. |
| 45 | 删除: write(filepath.Join(bin, "xsettingsd"), "#!/bin/sh\ntrap 'echo reload >> "+filepath.Join(root, "reloads")+"' HUP\nwhile :; do sleep 1 & wait $!; done\n", 0o700) | |
| 51 | 新增: write(filepath.Join(bin, "xsettingsd"), "#!/bin/sh\ntrap 'echo reload >> \"$CAGE_RESIZE_FIXTURE/reloads\"' HUP\nwhile :; do sleep 1 & wait $!; done\n", 0o700) | |
| 46 | 52 | resize := func(scale string) string { |
| 47 | 53 | t.Helper() |
| 48 | 54 | script := strings.NewReplacer("/run/cage-desktop", desktop, "/run/cage-phone-desktop", phone).Replace(desktopResizeScript(1000, 800, scale)) |
| @@ -91,6 +91,8 @@ finally { if ($progressStream) { $progressStream.Dispose() } } | ||
| 91 | 91 | try{ |
| 92 | 92 | if($context){Wait-CageHostEnrollment $context $worker} |
| 93 | 93 | $process=Start-Process -FilePath (Join-Path ([Environment]::GetFolderPath('System')) 'WindowsPowerShell/v1.0/powershell.exe') -ArgumentList @('-NoLogo','-NoProfile','-ExecutionPolicy','RemoteSigned','-EncodedCommand',$encoded) -Verb RunAs -PassThru |
| 94 | 新增: # Windows PowerShell 5.1 must retain a handle before waiting to read ExitCode. | |
| 95 | 新增: $null=$process.Handle | |
| 94 | 96 | if($context){Set-CageHostEnrollmentAdmin $context $process} |
| 95 | 97 | Wait-CageWindowsInstaller $process $progressFile |
| 96 | 98 | if($process.ExitCode -ne 0){throw 'Windows setup did not complete; existing VM and data were preserved.'} |
| @@ -84,6 +84,7 @@ try { | ||
| 84 | 84 | $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($command)) |
| 85 | 85 | $child = Start-Process -FilePath (Get-Process -Id $PID).Path -ArgumentList @('-NoLogo','-NoProfile','-NonInteractive','-EncodedCommand',$encoded) -RedirectStandardOutput $stdout -RedirectStandardError $stderr -PassThru |
| 86 | 86 | try { |
| 87 | 新增: $null = $child.Handle | |
| 87 | 88 | $forwarded = @(Wait-CageWindowsInstaller $child $progressFile) |
| 88 | 89 | Assert-Check ($child.ExitCode -eq 0) ('Encoded installer wrapper failed. '+[IO.File]::ReadAllText($stderr)) |
| 89 | 90 | Assert-Check ($forwarded[-1] -ceq 'CAGE_GUEST_STAGE windows-11 oobe') 'The actual child could not publish its final stage.' |

