From 220d86bff3389c091261be436414b516652b41d6 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Fri, 12 Jun 2026 22:47:19 +0000 Subject: [PATCH 01/15] Bump os-image tgz --- image-metalinks/ubuntu-noble/ubuntu-noble.meta4 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/image-metalinks/ubuntu-noble/ubuntu-noble.meta4 b/image-metalinks/ubuntu-noble/ubuntu-noble.meta4 index 7fe006016b..ad60071fca 100644 --- a/image-metalinks/ubuntu-noble/ubuntu-noble.meta4 +++ b/image-metalinks/ubuntu-noble/ubuntu-noble.meta4 @@ -1,12 +1,12 @@ - abaf1e872ab5fae378ba869e97994d26b0c390296abf57f57e1ee32b55c113247174b31daa2e3ebddd7218013ef5e3fb90015ea4e2e253bf57e9104db527b4e7 - 235331e441d4594d54a8fa33120091414eef646b20518b8ecb697f84160b7d40 - af7b9a5f1b8a419061d8b48c7d2f63d7721ff542 - 59fd4f46b08051601c69976b106bf6fc - 377555609 + a72cb482265c7e1a4f1ee066d13f10fff03a2a94cb5b00684822aac40198c22e9d2154e188d3dc2b4b461eb9373b48f669640d17cc94da9903d1a56af518d104 + 219b14a94547be8be742f37273ebff38d83150d2a496243c27c69faec2d67596 + a96ec608d96e4df000f66fea3f87f4c74322d539 + bca817458331da37f9f0bbece452f3e6 + 376579594 https://storage.googleapis.com/bosh-os-images/ubuntu-noble/ubuntu-noble.tgz - 120.0.0 + 121.0.0 be253863f3ed36a79daa272c9f23f902422486f46fb84114da8dcb42ce48610048cafa8021e0122c8adf468f9f4c81472a1795db6290f8747a4c8cf5bcdeb18c @@ -15,8 +15,8 @@ b1e24e5bb6d70a57b4d282b948136d67 8523 https://storage.googleapis.com/bosh-os-images/ubuntu-noble/usn-log.json - 120.0.0 + 121.0.0 metalink-repository-resource/0.0.0 - 2026-06-12T12:04:33.476081292Z + 2026-06-12T22:47:04.193133531Z From 67d12710fe43342491ec4c026180aa394c59df38 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Sat, 13 Jun 2026 10:02:43 +0000 Subject: [PATCH 02/15] Update vendored dependencies --- acceptance-tests/go.mod | 12 +- acceptance-tests/go.sum | 24 +- .../bosh-utils/system/cmd_runner_interface.go | 6 + .../bosh-utils/system/exec_cmd_runner.go | 8 + .../system/process_priority_unix.go | 48 + .../system/process_priority_windows.go | 66 + .../vendor/golang.org/x/net/html/entity.go | 5 +- .../vendor/golang.org/x/net/html/escape.go | 140 +- .../vendor/golang.org/x/net/html/foreign.go | 2 +- .../vendor/golang.org/x/net/html/parse.go | 249 +- .../vendor/golang.org/x/net/html/token.go | 41 +- .../golang.org/x/sync/errgroup/errgroup.go | 2 +- .../golang.org/x/sys/unix/ztypes_linux.go | 76 + .../golang.org/x/sys/unix/ztypes_linux_386.go | 4 + .../x/sys/unix/ztypes_linux_amd64.go | 4 + .../golang.org/x/sys/unix/ztypes_linux_arm.go | 4 + .../x/sys/unix/ztypes_linux_arm64.go | 4 + .../x/sys/unix/ztypes_linux_loong64.go | 4 + .../x/sys/unix/ztypes_linux_mips.go | 4 + .../x/sys/unix/ztypes_linux_mips64.go | 4 + .../x/sys/unix/ztypes_linux_mips64le.go | 4 + .../x/sys/unix/ztypes_linux_mipsle.go | 4 + .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 4 + .../x/sys/unix/ztypes_linux_ppc64.go | 4 + .../x/sys/unix/ztypes_linux_ppc64le.go | 4 + .../x/sys/unix/ztypes_linux_riscv64.go | 4 + .../x/sys/unix/ztypes_linux_s390x.go | 4 + .../x/sys/unix/ztypes_linux_sparc64.go | 4 + .../golang.org/x/sys/windows/aliases.go | 13 + .../golang.org/x/sys/windows/dll_windows.go | 380 + .../golang.org/x/sys/windows/env_windows.go | 57 + .../golang.org/x/sys/windows/eventlog.go | 20 + .../golang.org/x/sys/windows/exec_windows.go | 248 + .../x/sys/windows/memory_windows.go | 48 + .../golang.org/x/sys/windows/mkerrors.bash | 70 + .../x/sys/windows/mkknownfolderids.bash | 27 + .../golang.org/x/sys/windows/mksyscall.go | 9 + .../vendor/golang.org/x/sys/windows/race.go | 30 + .../vendor/golang.org/x/sys/windows/race0.go | 25 + .../x/sys/windows/security_windows.go | 1501 +++ .../golang.org/x/sys/windows/service.go | 257 + .../x/sys/windows/setupapi_windows.go | 1425 +++ .../vendor/golang.org/x/sys/windows/str.go | 22 + .../golang.org/x/sys/windows/syscall.go | 104 + .../x/sys/windows/syscall_windows.go | 1948 ++++ .../golang.org/x/sys/windows/types_windows.go | 4056 +++++++ .../x/sys/windows/types_windows_386.go | 35 + .../x/sys/windows/types_windows_amd64.go | 34 + .../x/sys/windows/types_windows_arm.go | 35 + .../x/sys/windows/types_windows_arm64.go | 34 + .../x/sys/windows/zerrors_windows.go | 9468 +++++++++++++++++ .../x/sys/windows/zknownfolderids_windows.go | 149 + .../x/sys/windows/zsyscall_windows.go | 4828 +++++++++ acceptance-tests/vendor/modules.txt | 13 +- 54 files changed, 25309 insertions(+), 266 deletions(-) create mode 100644 acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_unix.go create mode 100644 acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/aliases.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/dll_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/env_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/eventlog.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/exec_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/memory_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/mkerrors.bash create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/mkknownfolderids.bash create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/mksyscall.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/race.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/race0.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/security_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/service.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/setupapi_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/str.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/syscall.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/syscall_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/types_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/types_windows_386.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/types_windows_amd64.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/types_windows_arm.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/types_windows_arm64.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/zerrors_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go create mode 100644 acceptance-tests/vendor/golang.org/x/sys/windows/zsyscall_windows.go diff --git a/acceptance-tests/go.mod b/acceptance-tests/go.mod index 6b37ce2839..fba23ce6c6 100644 --- a/acceptance-tests/go.mod +++ b/acceptance-tests/go.mod @@ -3,7 +3,7 @@ module github.com/cloudfoundry/bosh-linux-stemcell-builder/acceptance-tests go 1.25.0 require ( - github.com/cloudfoundry/bosh-utils v0.0.615 + github.com/cloudfoundry/bosh-utils v0.0.616 github.com/onsi/ginkgo/v2 v2.29.0 github.com/onsi/gomega v1.41.0 gopkg.in/yaml.v2 v2.4.0 @@ -15,12 +15,12 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/pprof v0.0.0-20260507013755-92041b743c96 // indirect + github.com/google/pprof v0.0.0-20260604005048-7023385849c0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/mod v0.36.0 // indirect - golang.org/x/net v0.55.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.45.0 // indirect - golang.org/x/text v0.37.0 // indirect + golang.org/x/net v0.56.0 // indirect + golang.org/x/sync v0.21.0 // indirect + golang.org/x/sys v0.46.0 // indirect + golang.org/x/text v0.38.0 // indirect golang.org/x/tools v0.45.0 // indirect ) diff --git a/acceptance-tests/go.sum b/acceptance-tests/go.sum index a25860d303..d34c52adc7 100644 --- a/acceptance-tests/go.sum +++ b/acceptance-tests/go.sum @@ -2,8 +2,8 @@ github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAw github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= -github.com/cloudfoundry/bosh-utils v0.0.615 h1:jUk/Cb4Tbz6qfPLAn7BrvHVtCpa2abUfHHwiWhlchy0= -github.com/cloudfoundry/bosh-utils v0.0.615/go.mod h1:fkTnsAPEqLKjp13bb6DpK8XvUtqEFzviVW53Gc6FlEo= +github.com/cloudfoundry/bosh-utils v0.0.616 h1:+qyDltkMmUJ4WUQ9c0U55vwlPd9YtzpWapvdZ+Ov1V8= +github.com/cloudfoundry/bosh-utils v0.0.616/go.mod h1:+MBxSdFuhglWydWKltt9UsxhGh0HjHwuLRRE2UYE3ro= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs= @@ -20,8 +20,8 @@ github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/pprof v0.0.0-20260507013755-92041b743c96 h1:YDDnaZ9afWajDboPMt9Vikqca/yWAX7KAxVzb4lJU1M= -github.com/google/pprof v0.0.0-20260507013755-92041b743c96/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= +github.com/google/pprof v0.0.0-20260604005048-7023385849c0 h1:h1QTMDl6q9wDvDCJVpKQSjgleGFYnd2fOxmg2K+6BGE= +github.com/google/pprof v0.0.0-20260604005048-7023385849c0/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE= github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -56,14 +56,14 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= -golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= -golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= -golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= -golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= +golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= +golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= +golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE= +golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A= diff --git a/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/cmd_runner_interface.go b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/cmd_runner_interface.go index 64a28c1515..cad6f6488a 100644 --- a/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/cmd_runner_interface.go +++ b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/cmd_runner_interface.go @@ -18,6 +18,12 @@ type Command struct { // Don't echo stdout/stderr Quiet bool + // Run command with a lower scheduling priority than the parent process. + // On Unix: nice value is parent + 5, clamped at 19. + // On Windows: priority class is set to BelowNormal. + // If the parent is already at the minimum priority, the child will run at the same level. + SpawnWithLowerPriority bool + Stdin io.Reader // Full stdout and stderr will be captured to memory diff --git a/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/exec_cmd_runner.go b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/exec_cmd_runner.go index d9ffadd07b..ae76e2cbae 100644 --- a/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/exec_cmd_runner.go +++ b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/exec_cmd_runner.go @@ -24,6 +24,10 @@ func (r execCmdRunner) RunComplexCommand(cmd Command) (string, string, int, erro return "", "", -1, err } + if cmd.SpawnWithLowerPriority { + r.lowerProcessPriority(cmd.Name, process.cmd.Process.Pid) //nolint:errcheck + } + result := <-process.Wait() return result.Stdout, result.Stderr, result.ExitStatus, result.Error @@ -37,6 +41,10 @@ func (r execCmdRunner) RunComplexCommandAsync(cmd Command) (Process, error) { return nil, err } + if cmd.SpawnWithLowerPriority { + r.lowerProcessPriority(cmd.Name, process.cmd.Process.Pid) //nolint:errcheck + } + return process, nil } diff --git a/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_unix.go b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_unix.go new file mode 100644 index 0000000000..05bcbd85fa --- /dev/null +++ b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_unix.go @@ -0,0 +1,48 @@ +//go:build !windows + +// Inspired by github.com/hekmon/processpriority (MIT, Copyright 2024 Edouard Hur). +// Reimplemented inline to avoid the external dependency. + +package system + +import ( + "os" + "syscall" +) + +// getProcessPriority returns the nice value of the process with the given pid. +func getProcessPriority(pid int) (int, error) { + // syscall.Getpriority returns the "kernel nice" (20 - nice), so we convert. + // See https://linux.die.net/man/2/getpriority + knice, err := syscall.Getpriority(syscall.PRIO_PROCESS, pid) + if err != nil { + return 0, err + } + nice := (knice - 20) * -1 + return nice, nil +} + +// setProcessPriority sets the nice value of the process with the given pid. +func setProcessPriority(pid int, nice int) error { + return syscall.Setpriority(syscall.PRIO_PROCESS, pid, nice) +} + +// lowerProcessPriority sets the child process nice value to parent + 5, clamped at 19. +func (r execCmdRunner) lowerProcessPriority(logTag string, processPid int) error { + parentPid := os.Getpid() + + parentNice, err := getProcessPriority(parentPid) + if err != nil { + r.logger.Error(logTag, "Error getting priority of the current process (pid %d): %s", parentPid, err) + return err + } + r.logger.Debug(logTag, "Current process nice value is %d", parentNice) + + childNice := min(parentNice+5, 19) + r.logger.Debug(logTag, "Setting child process (pid %d) nice value to %d", processPid, childNice) + + if err = setProcessPriority(processPid, childNice); err != nil { + r.logger.Error(logTag, "Error setting priority on child process (pid %d): %s", processPid, err) + } + return err +} diff --git a/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_windows.go b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_windows.go new file mode 100644 index 0000000000..6ed76d8768 --- /dev/null +++ b/acceptance-tests/vendor/github.com/cloudfoundry/bosh-utils/system/process_priority_windows.go @@ -0,0 +1,66 @@ +//go:build windows + +// Inspired by github.com/hekmon/processpriority (MIT, Copyright 2024 Edouard Hur). +// Reimplemented inline to avoid the external dependency. + +package system + +import ( + "fmt" + "os" + + "golang.org/x/sys/windows" +) + +const ( + // Windows process priority classes. + // https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities + winPriorityBelowNormal = 0x4000 // BELOW_NORMAL_PRIORITY_CLASS +) + +// getProcessPriority returns the priority class of the process with the given pid. +func getProcessPriority(pid int) (int, error) { + handle, err := windows.OpenProcess(windows.PROCESS_QUERY_INFORMATION, false, uint32(pid)) + if err != nil { + return 0, fmt.Errorf("failed to open process: %w", err) + } + defer windows.CloseHandle(handle) //nolint:errcheck + + priority, err := windows.GetPriorityClass(handle) + if err != nil { + return 0, fmt.Errorf("failed to get priority class: %w", err) + } + return int(priority), nil +} + +// setProcessPriority sets the priority class of the process with the given pid. +func setProcessPriority(pid int, priority int) error { + handle, err := windows.OpenProcess(windows.PROCESS_SET_INFORMATION, false, uint32(pid)) + if err != nil { + return fmt.Errorf("failed to open process: %w", err) + } + defer windows.CloseHandle(handle) //nolint:errcheck + + if err = windows.SetPriorityClass(handle, uint32(priority)); err != nil { + return fmt.Errorf("failed to set priority class: %w", err) + } + return nil +} + +// lowerProcessPriority sets the child process priority class to BelowNormal. +func (r execCmdRunner) lowerProcessPriority(logTag string, processPid int) error { + parentPid := os.Getpid() + + parentPriority, err := getProcessPriority(parentPid) + if err != nil { + r.logger.Error(logTag, "Error getting priority of the current process (pid %d): %s", parentPid, err) + return err + } + r.logger.Debug(logTag, "Current process priority class is %d", parentPriority) + + r.logger.Debug(logTag, "Setting child process (pid %d) priority to BelowNormal", processPid) + if err = setProcessPriority(processPid, winPriorityBelowNormal); err != nil { + r.logger.Error(logTag, "Error setting priority on child process (pid %d): %s", processPid, err) + } + return err +} diff --git a/acceptance-tests/vendor/golang.org/x/net/html/entity.go b/acceptance-tests/vendor/golang.org/x/net/html/entity.go index b628880a01..4e8d5d55f2 100644 --- a/acceptance-tests/vendor/golang.org/x/net/html/entity.go +++ b/acceptance-tests/vendor/golang.org/x/net/html/entity.go @@ -2156,9 +2156,8 @@ var entity = map[string]rune{ // HTML entities that are two unicode codepoints. var entity2 = map[string][2]rune{ - // TODO(nigeltao): Handle replacements that are wider than their names. - // "nLt;": {'\u226A', '\u20D2'}, - // "nGt;": {'\u226B', '\u20D2'}, + "nLt;": {'\u226A', '\u20D2'}, + "nGt;": {'\u226B', '\u20D2'}, "NotEqualTilde;": {'\u2242', '\u0338'}, "NotGreaterFullEqual;": {'\u2267', '\u0338'}, "NotGreaterGreater;": {'\u226B', '\u0338'}, diff --git a/acceptance-tests/vendor/golang.org/x/net/html/escape.go b/acceptance-tests/vendor/golang.org/x/net/html/escape.go index 12f2273706..df3edc5b12 100644 --- a/acceptance-tests/vendor/golang.org/x/net/html/escape.go +++ b/acceptance-tests/vendor/golang.org/x/net/html/escape.go @@ -6,6 +6,7 @@ package html import ( "bytes" + "slices" "strings" "unicode/utf8" ) @@ -50,25 +51,24 @@ var replacementTable = [...]rune{ // 0x0D->'\u000D' is a no-op. } -// unescapeEntity reads an entity like "<" from b[src:] and writes the -// corresponding "<" to b[dst:], returning the incremented dst and src cursors. -// Precondition: b[src] == '&' && dst <= src. -// attribute should be true if parsing an attribute value. -func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { +// unescapeEntity attempts to consume a character reference from s[src:], +// returning the rune, potential second rune, and number of bytes consumed +// (which indicates the length of the character reference). It is assumed that +// the first byte of s is '&'. attribute should be true if parsing an attribute +// value. +func unescapeEntity(s []byte, attribute bool) (rune, rune, int) { // https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference // i starts at 1 because we already know that s[0] == '&'. - i, s := 1, b[src:] + i := 1 if len(s) <= 1 { - b[dst] = b[src] - return dst + 1, src + 1 + return '&', 0, 1 } if s[i] == '#' { - if len(s) <= 3 { // We need to have at least "&#.". - b[dst] = b[src] - return dst + 1, src + 1 + if len(s) <= 2 { // We need to have at least "&#". + return '&', 0, 1 } i++ c := s[i] @@ -78,34 +78,43 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { i++ } + i0 := i x := '\x00' for i < len(s) { c = s[i] - i++ + var d rune + var mult rune if hex { + mult = 16 if '0' <= c && c <= '9' { - x = 16*x + rune(c) - '0' - continue + d = rune(c) - '0' } else if 'a' <= c && c <= 'f' { - x = 16*x + rune(c) - 'a' + 10 - continue + d = rune(c) - 'a' + 10 } else if 'A' <= c && c <= 'F' { - x = 16*x + rune(c) - 'A' + 10 - continue + d = rune(c) - 'A' + 10 + } else { + break + } + } else { + mult = 10 + if '0' <= c && c <= '9' { + d = rune(c) - '0' + } else { + break } - } else if '0' <= c && c <= '9' { - x = 10*x + rune(c) - '0' - continue } - if c != ';' { - i-- + if x <= 0x10FFFF { + x = mult*x + d } - break + i++ + } + + if i == i0 { // No characters matched. + return '&', 0, 1 } - if i <= 3 { // No characters matched. - b[dst] = b[src] - return dst + 1, src + 1 + if i < len(s) && s[i] == ';' { + i++ } if 0x80 <= x && x <= 0x9F { @@ -116,7 +125,7 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { x = '\uFFFD' } - return dst + utf8.EncodeRune(b[dst:], x), src + i + return x, 0, i } // Consume the maximum number of characters possible, with the @@ -141,10 +150,9 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { } else if attribute && entityName[len(entityName)-1] != ';' && len(s) > i && s[i] == '=' { // No-op. } else if x := entity[entityName]; x != 0 { - return dst + utf8.EncodeRune(b[dst:], x), src + i + return x, 0, i } else if x := entity2[entityName]; x[0] != 0 { - dst1 := dst + utf8.EncodeRune(b[dst:], x[0]) - return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i + return x[0], x[1], i } else if !attribute { maxLen := len(entityName) - 1 if maxLen > longestEntityWithoutSemicolon { @@ -152,35 +160,67 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { } for j := maxLen; j > 1; j-- { if x := entity[entityName[:j]]; x != 0 { - return dst + utf8.EncodeRune(b[dst:], x), src + j + 1 + return x, 0, j + 1 } } } - dst1, src1 = dst+i, src+i - copy(b[dst:dst1], b[src:src1]) - return dst1, src1 + return '&', 0, 1 } -// unescape unescapes b's entities in-place, so that "a<b" becomes "a entityNameLen { + if reusingB { + out = slices.Clone(out) + reusingB = false } - return b[0:dst] + out = slices.Grow(out, replLen) + } + out = utf8.AppendRune(out, r1) + if r2 != 0 { + out = utf8.AppendRune(out, r2) } + + src += entityNameLen } - return b + + return out } // lower lower-cases the A-Z bytes in b in-place, so that "aBc" becomes "abc". diff --git a/acceptance-tests/vendor/golang.org/x/net/html/foreign.go b/acceptance-tests/vendor/golang.org/x/net/html/foreign.go index e8515d8e88..65d01d1ed9 100644 --- a/acceptance-tests/vendor/golang.org/x/net/html/foreign.go +++ b/acceptance-tests/vendor/golang.org/x/net/html/foreign.go @@ -23,7 +23,7 @@ func adjustForeignAttributes(aa []Attribute) { } switch a.Key { case "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", - "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "xmlns:xlink": + "xlink:title", "xlink:type", "xml:lang", "xml:space", "xmlns:xlink": j := strings.Index(a.Key, ":") aa[i].Namespace = a.Key[:j] aa[i].Key = a.Key[j+1:] diff --git a/acceptance-tests/vendor/golang.org/x/net/html/parse.go b/acceptance-tests/vendor/golang.org/x/net/html/parse.go index b3d2a25581..165b6108d4 100644 --- a/acceptance-tests/vendor/golang.org/x/net/html/parse.go +++ b/acceptance-tests/vendor/golang.org/x/net/html/parse.go @@ -63,7 +63,7 @@ func (p *parser) top() *Node { // Stop tags for use in popUntil. These come from section 12.2.4.2. var ( defaultScopeStopTags = map[string][]a.Atom{ - "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, + "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template, a.Select}, "math": {a.AnnotationXml, a.Mi, a.Mn, a.Mo, a.Ms, a.Mtext}, "svg": {a.Desc, a.ForeignObject, a.Title}, } @@ -78,7 +78,6 @@ const ( tableScope tableRowScope tableBodyScope - selectScope ) // popUntil pops the stack of open elements at the highest element whose tag @@ -133,10 +132,6 @@ func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { if tagAtom == a.Html || tagAtom == a.Table || tagAtom == a.Template { return -1 } - case selectScope: - if tagAtom != a.Optgroup && tagAtom != a.Option { - return -1 - } default: panic(fmt.Sprintf("html: internal error: indexOfElementInScope unknown scope: %d", s)) } @@ -460,21 +455,6 @@ func (p *parser) resetInsertionMode() { } switch n.DataAtom { - case a.Select: - if !last { - for ancestor, first := n, p.oe[0]; ancestor != first; { - ancestor = p.oe[p.oe.index(ancestor)-1] - switch ancestor.DataAtom { - case a.Template: - p.im = inSelectIM - return - case a.Table: - p.im = inSelectInTableIM - return - } - } - } - p.im = inSelectIM case a.Td, a.Th: // TODO: remove this divergence from the HTML5 spec. // @@ -1002,7 +982,10 @@ func inBodyIM(p *parser) bool { p.popUntil(buttonScope, a.P) p.addElement() case a.Button: - p.popUntil(defaultScope, a.Button) + if p.elementInScope(defaultScope, a.Button) { + p.generateImpliedEndTags() + p.popUntil(defaultScope, a.Button) + } p.reconstructActiveFormattingElements() p.addElement() p.framesetOK = false @@ -1040,7 +1023,18 @@ func inBodyIM(p *parser) bool { p.framesetOK = false p.im = inTableIM return true - case a.Area, a.Br, a.Embed, a.Img, a.Input, a.Keygen, a.Wbr: + case a.Area, a.Br, a.Embed, a.Img, a.Keygen, a.Wbr: + p.reconstructActiveFormattingElements() + p.addElement() + p.oe.pop() + p.acknowledgeSelfClosingTag() + p.framesetOK = false + case a.Input: + if p.fragment && p.context.DataAtom == a.Select { + // Ignore the token. + return true + } + p.popUntil(defaultScope, a.Select) p.reconstructActiveFormattingElements() p.addElement() p.oe.pop() @@ -1061,7 +1055,13 @@ func inBodyIM(p *parser) bool { p.oe.pop() p.acknowledgeSelfClosingTag() case a.Hr: - p.popUntil(buttonScope, a.P) + if p.elementInScope(buttonScope, a.P) { + p.generateImpliedEndTags("p") + p.popUntil(defaultScope, a.P) + } + if p.elementInScope(defaultScope, a.Select) { + p.generateImpliedEndTags() + } p.addElement() p.oe.pop() p.acknowledgeSelfClosingTag() @@ -1095,13 +1095,30 @@ func inBodyIM(p *parser) bool { // Don't let the tokenizer go into raw text mode when scripting is disabled. p.tokenizer.NextIsNotRawText() case a.Select: + if p.fragment && p.context.DataAtom == a.Select { + // Ignore the token. + return true + } else if p.popUntil(defaultScope, a.Select) { + return true + } p.reconstructActiveFormattingElements() p.addElement() p.framesetOK = false - p.im = inSelectIM return true - case a.Optgroup, a.Option: - if p.top().DataAtom == a.Option { + case a.Option: + if p.elementInScope(defaultScope, a.Select) { + p.generateImpliedEndTags("optgroup") + // If oe has option element in scope, parse error? + } else if p.top().DataAtom == a.Option { + p.oe.pop() + } + p.reconstructActiveFormattingElements() + p.addElement() + case a.Optgroup: + if p.elementInScope(defaultScope, a.Select) { + p.generateImpliedEndTags() + // If oe has option or optgroup element in scope, parse error? + } else if p.top().DataAtom == a.Option { p.oe.pop() } p.reconstructActiveFormattingElements() @@ -1149,7 +1166,12 @@ func inBodyIM(p *parser) bool { return false } return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Summary, a.Ul: + case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Select, a.Summary, a.Ul: + if !p.elementInScope(defaultScope, p.tok.DataAtom) { + // Ignore the token. + return true + } + p.generateImpliedEndTags() p.popUntil(defaultScope, p.tok.DataAtom) case a.Form: if p.oe.contains(a.Template) { @@ -1488,17 +1510,6 @@ func inTableIM(p *parser) bool { } p.addElement() p.form = p.oe.pop() - case a.Select: - p.reconstructActiveFormattingElements() - switch p.top().DataAtom { - case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr: - p.fosterParenting = true - } - p.addElement() - p.fosterParenting = false - p.framesetOK = false - p.im = inSelectInTableIM - return true } case EndTagToken: switch p.tok.DataAtom { @@ -1547,12 +1558,6 @@ func inCaptionIM(p *parser) bool { p.clearActiveFormattingElements() p.im = inTableIM return false - case a.Select: - p.reconstructActiveFormattingElements() - p.addElement() - p.framesetOK = false - p.im = inSelectInTableIM - return true } case EndTagToken: switch p.tok.DataAtom { @@ -1762,12 +1767,6 @@ func inCellIM(p *parser) bool { } // Ignore the token. return true - case a.Select: - p.reconstructActiveFormattingElements() - p.addElement() - p.framesetOK = false - p.im = inSelectInTableIM - return true } case EndTagToken: switch p.tok.DataAtom { @@ -1798,118 +1797,6 @@ func inCellIM(p *parser) bool { return inBodyIM(p) } -// Section 12.2.6.4.16. -func inSelectIM(p *parser) bool { - switch p.tok.Type { - case TextToken: - p.addText(strings.Replace(p.tok.Data, "\x00", "", -1)) - case StartTagToken: - switch p.tok.DataAtom { - case a.Html: - return inBodyIM(p) - case a.Option: - if p.top().DataAtom == a.Option { - p.oe.pop() - } - p.addElement() - case a.Optgroup: - if p.top().DataAtom == a.Option { - p.oe.pop() - } - if p.top().DataAtom == a.Optgroup { - p.oe.pop() - } - p.addElement() - case a.Select: - if !p.popUntil(selectScope, a.Select) { - // Ignore the token. - return true - } - p.resetInsertionMode() - case a.Input, a.Keygen, a.Textarea: - if p.elementInScope(selectScope, a.Select) { - p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) - return false - } - // In order to properly ignore