From 705937ed093889163197b2c5b864b0b0bbbb720d Mon Sep 17 00:00:00 2001 From: hanchao Date: Sat, 25 Feb 2023 18:49:27 +0800 Subject: [PATCH] golang: add golang package test --- ...ort-for-SysProcAttr.Pdeathsig-on-Fre.patch | 658 ++++++++++++++++++ golang.spec | 23 +- 2 files changed, 664 insertions(+), 17 deletions(-) create mode 100644 0030-syscall-add-support-for-SysProcAttr.Pdeathsig-on-Fre.patch diff --git a/0030-syscall-add-support-for-SysProcAttr.Pdeathsig-on-Fre.patch b/0030-syscall-add-support-for-SysProcAttr.Pdeathsig-on-Fre.patch new file mode 100644 index 0000000..1f3e9d9 --- /dev/null +++ b/0030-syscall-add-support-for-SysProcAttr.Pdeathsig-on-Fre.patch @@ -0,0 +1,658 @@ +From 8f0e7dd05237a35144c7790f2c7400edc1a0ae16 Mon Sep 17 00:00:00 2001 +From: Tobias Klauser +Date: Wed, 13 Oct 2021 16:30:12 +0200 +Subject: [PATCH] syscall: add support for SysProcAttr.Pdeathsig on FreeBSD + +Fixes #46258 + +Change-Id: I63f70e67274a9df39c757243b99b12e50a9e4784 +Reviewed-on: https://go-review.googlesource.com/c/go/+/355570 +Trust: Tobias Klauser +Run-TryBot: Tobias Klauser +TryBot-Result: Go Bot +Reviewed-by: Ian Lance Taylor +--- + src/syscall/exec_freebsd.go | 299 ++++++++++++++++++++++++++++ + src/syscall/exec_linux.go | 2 +- + src/syscall/exec_pdeathsig_test.go | 135 +++++++++++++ + src/syscall/syscall_freebsd_test.go | 11 + + src/syscall/syscall_linux_test.go | 117 ----------- + 5 files changed, 446 insertions(+), 118 deletions(-) + create mode 100644 src/syscall/exec_freebsd.go + create mode 100644 src/syscall/exec_pdeathsig_test.go + +diff --git a/src/syscall/exec_freebsd.go b/src/syscall/exec_freebsd.go +new file mode 100644 +index 0000000000..a7410db4b6 +--- /dev/null ++++ b/src/syscall/exec_freebsd.go +@@ -0,0 +1,299 @@ ++// Copyright 2021 The Go Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++package syscall ++ ++import ( ++ "runtime" ++ "unsafe" ++) ++ ++type SysProcAttr struct { ++ Chroot string // Chroot. ++ Credential *Credential // Credential. ++ Ptrace bool // Enable tracing. ++ Setsid bool // Create session. ++ // Setpgid sets the process group ID of the child to Pgid, ++ // or, if Pgid == 0, to the new child's process ID. ++ Setpgid bool ++ // Setctty sets the controlling terminal of the child to ++ // file descriptor Ctty. Ctty must be a descriptor number ++ // in the child process: an index into ProcAttr.Files. ++ // This is only meaningful if Setsid is true. ++ Setctty bool ++ Noctty bool // Detach fd 0 from controlling terminal ++ Ctty int // Controlling TTY fd ++ // Foreground places the child process group in the foreground. ++ // This implies Setpgid. The Ctty field must be set to ++ // the descriptor of the controlling TTY. ++ // Unlike Setctty, in this case Ctty must be a descriptor ++ // number in the parent process. ++ Foreground bool ++ Pgid int // Child's process group ID if Setpgid. ++ Pdeathsig Signal // Signal that the process will get when its parent dies (Linux and FreeBSD only) ++} ++ ++const ( ++ _P_PID = 0 ++ ++ _PROC_PDEATHSIG_CTL = 11 ++) ++ ++// Implemented in runtime package. ++func runtime_BeforeFork() ++func runtime_AfterFork() ++func runtime_AfterForkInChild() ++ ++// Fork, dup fd onto 0..len(fd), and exec(argv0, argvv, envv) in child. ++// If a dup or exec fails, write the errno error to pipe. ++// (Pipe is close-on-exec so if exec succeeds, it will be closed.) ++// In the child, this function must not acquire any locks, because ++// they might have been locked at the time of the fork. This means ++// no rescheduling, no malloc calls, and no new stack segments. ++// For the same reason compiler does not race instrument it. ++// The calls to RawSyscall are okay because they are assembly ++// functions that do not grow the stack. ++//go:norace ++func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) { ++ // Declare all variables at top in case any ++ // declarations require heap allocation (e.g., err1). ++ var ( ++ r1 uintptr ++ err1 Errno ++ nextfd int ++ i int ++ ) ++ ++ // Record parent PID so child can test if it has died. ++ ppid, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) ++ ++ // guard against side effects of shuffling fds below. ++ // Make sure that nextfd is beyond any currently open files so ++ // that we can't run the risk of overwriting any of them. ++ fd := make([]int, len(attr.Files)) ++ nextfd = len(attr.Files) ++ for i, ufd := range attr.Files { ++ if nextfd < int(ufd) { ++ nextfd = int(ufd) ++ } ++ fd[i] = int(ufd) ++ } ++ nextfd++ ++ ++ // About to call fork. ++ // No more allocation or calls of non-assembly functions. ++ runtime_BeforeFork() ++ r1, _, err1 = RawSyscall(SYS_FORK, 0, 0, 0) ++ if err1 != 0 { ++ runtime_AfterFork() ++ return 0, err1 ++ } ++ ++ if r1 != 0 { ++ // parent; return PID ++ runtime_AfterFork() ++ return int(r1), 0 ++ } ++ ++ // Fork succeeded, now in child. ++ ++ // Enable tracing if requested. ++ if sys.Ptrace { ++ _, _, err1 = RawSyscall(SYS_PTRACE, uintptr(PTRACE_TRACEME), 0, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // Session ID ++ if sys.Setsid { ++ _, _, err1 = RawSyscall(SYS_SETSID, 0, 0, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // Set process group ++ if sys.Setpgid || sys.Foreground { ++ // Place child in process group. ++ _, _, err1 = RawSyscall(SYS_SETPGID, 0, uintptr(sys.Pgid), 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ if sys.Foreground { ++ // This should really be pid_t, however _C_int (aka int32) is ++ // generally equivalent. ++ pgrp := _C_int(sys.Pgid) ++ if pgrp == 0 { ++ r1, _, err1 = RawSyscall(SYS_GETPID, 0, 0, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ ++ pgrp = _C_int(r1) ++ } ++ ++ // Place process group in foreground. ++ _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSPGRP), uintptr(unsafe.Pointer(&pgrp))) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // Restore the signal mask. We do this after TIOCSPGRP to avoid ++ // having the kernel send a SIGTTOU signal to the process group. ++ runtime_AfterForkInChild() ++ ++ // Chroot ++ if chroot != nil { ++ _, _, err1 = RawSyscall(SYS_CHROOT, uintptr(unsafe.Pointer(chroot)), 0, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // User and groups ++ if cred := sys.Credential; cred != nil { ++ ngroups := uintptr(len(cred.Groups)) ++ groups := uintptr(0) ++ if ngroups > 0 { ++ groups = uintptr(unsafe.Pointer(&cred.Groups[0])) ++ } ++ if !cred.NoSetGroups { ++ _, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, groups, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ _, _, err1 = RawSyscall(SYS_SETGID, uintptr(cred.Gid), 0, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ _, _, err1 = RawSyscall(SYS_SETUID, uintptr(cred.Uid), 0, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // Chdir ++ if dir != nil { ++ _, _, err1 = RawSyscall(SYS_CHDIR, uintptr(unsafe.Pointer(dir)), 0, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // Parent death signal ++ if sys.Pdeathsig != 0 { ++ switch runtime.GOARCH { ++ case "386", "arm": ++ _, _, err1 = RawSyscall6(SYS_PROCCTL, _P_PID, 0, 0, _PROC_PDEATHSIG_CTL, uintptr(unsafe.Pointer(&sys.Pdeathsig)), 0) ++ default: ++ _, _, err1 = RawSyscall6(SYS_PROCCTL, _P_PID, 0, _PROC_PDEATHSIG_CTL, uintptr(unsafe.Pointer(&sys.Pdeathsig)), 0, 0) ++ } ++ if err1 != 0 { ++ goto childerror ++ } ++ ++ // Signal self if parent is already dead. This might cause a ++ // duplicate signal in rare cases, but it won't matter when ++ // using SIGKILL. ++ r1, _, _ = RawSyscall(SYS_GETPPID, 0, 0, 0) ++ if r1 != ppid { ++ pid, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) ++ _, _, err1 := RawSyscall(SYS_KILL, pid, uintptr(sys.Pdeathsig), 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ } ++ ++ // Pass 1: look for fd[i] < i and move those up above len(fd) ++ // so that pass 2 won't stomp on an fd it needs later. ++ if pipe < nextfd { ++ _, _, err1 = RawSyscall(SYS_DUP2, uintptr(pipe), uintptr(nextfd), 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ RawSyscall(SYS_FCNTL, uintptr(nextfd), F_SETFD, FD_CLOEXEC) ++ pipe = nextfd ++ nextfd++ ++ } ++ for i = 0; i < len(fd); i++ { ++ if fd[i] >= 0 && fd[i] < int(i) { ++ if nextfd == pipe { // don't stomp on pipe ++ nextfd++ ++ } ++ _, _, err1 = RawSyscall(SYS_DUP2, uintptr(fd[i]), uintptr(nextfd), 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ RawSyscall(SYS_FCNTL, uintptr(nextfd), F_SETFD, FD_CLOEXEC) ++ fd[i] = nextfd ++ nextfd++ ++ } ++ } ++ ++ // Pass 2: dup fd[i] down onto i. ++ for i = 0; i < len(fd); i++ { ++ if fd[i] == -1 { ++ RawSyscall(SYS_CLOSE, uintptr(i), 0, 0) ++ continue ++ } ++ if fd[i] == int(i) { ++ // dup2(i, i) won't clear close-on-exec flag on Linux, ++ // probably not elsewhere either. ++ _, _, err1 = RawSyscall(SYS_FCNTL, uintptr(fd[i]), F_SETFD, 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ continue ++ } ++ // The new fd is created NOT close-on-exec, ++ // which is exactly what we want. ++ _, _, err1 = RawSyscall(SYS_DUP2, uintptr(fd[i]), uintptr(i), 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // By convention, we don't close-on-exec the fds we are ++ // started with, so if len(fd) < 3, close 0, 1, 2 as needed. ++ // Programs that know they inherit fds >= 3 will need ++ // to set them close-on-exec. ++ for i = len(fd); i < 3; i++ { ++ RawSyscall(SYS_CLOSE, uintptr(i), 0, 0) ++ } ++ ++ // Detach fd 0 from tty ++ if sys.Noctty { ++ _, _, err1 = RawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // Set the controlling TTY to Ctty ++ if sys.Setctty { ++ _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0) ++ if err1 != 0 { ++ goto childerror ++ } ++ } ++ ++ // Time to exec. ++ _, _, err1 = RawSyscall(SYS_EXECVE, ++ uintptr(unsafe.Pointer(argv0)), ++ uintptr(unsafe.Pointer(&argv[0])), ++ uintptr(unsafe.Pointer(&envv[0]))) ++ ++childerror: ++ // send error code on pipe ++ RawSyscall(SYS_WRITE, uintptr(pipe), uintptr(unsafe.Pointer(&err1)), unsafe.Sizeof(err1)) ++ for { ++ RawSyscall(SYS_EXIT, 253, 0, 0) ++ } ++} +diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go +index ccc0e39e30..b678ee4fab 100644 +--- a/src/syscall/exec_linux.go ++++ b/src/syscall/exec_linux.go +@@ -46,7 +46,7 @@ type SysProcAttr struct { + // number in the parent process. + Foreground bool + Pgid int // Child's process group ID if Setpgid. +- Pdeathsig Signal // Signal that the process will get when its parent dies (Linux only) ++ Pdeathsig Signal // Signal that the process will get when its parent dies (Linux and FreeBSD only) + Cloneflags uintptr // Flags for clone calls (Linux only) + Unshareflags uintptr // Flags for unshare calls (Linux only) + UidMappings []SysProcIDMap // User ID mappings for user namespaces. +diff --git a/src/syscall/exec_pdeathsig_test.go b/src/syscall/exec_pdeathsig_test.go +new file mode 100644 +index 0000000000..6533d3a138 +--- /dev/null ++++ b/src/syscall/exec_pdeathsig_test.go +@@ -0,0 +1,135 @@ ++// Copyright 2015 The Go Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++//go:build freebsd || linux ++// +build freebsd linux ++ ++package syscall_test ++ ++import ( ++ "bufio" ++ "fmt" ++ "io" ++ "os" ++ "os/exec" ++ "os/signal" ++ "path/filepath" ++ "syscall" ++ "testing" ++ "time" ++) ++ ++func TestDeathSignal(t *testing.T) { ++ if os.Getuid() != 0 { ++ t.Skip("skipping root only test") ++ } ++ ++ // Copy the test binary to a location that a non-root user can read/execute ++ // after we drop privileges ++ tempDir, err := os.MkdirTemp("", "TestDeathSignal") ++ if err != nil { ++ t.Fatalf("cannot create temporary directory: %v", err) ++ } ++ defer os.RemoveAll(tempDir) ++ os.Chmod(tempDir, 0755) ++ ++ tmpBinary := filepath.Join(tempDir, filepath.Base(os.Args[0])) ++ ++ src, err := os.Open(os.Args[0]) ++ if err != nil { ++ t.Fatalf("cannot open binary %q, %v", os.Args[0], err) ++ } ++ defer src.Close() ++ ++ dst, err := os.OpenFile(tmpBinary, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0755) ++ if err != nil { ++ t.Fatalf("cannot create temporary binary %q, %v", tmpBinary, err) ++ } ++ if _, err := io.Copy(dst, src); err != nil { ++ t.Fatalf("failed to copy test binary to %q, %v", tmpBinary, err) ++ } ++ err = dst.Close() ++ if err != nil { ++ t.Fatalf("failed to close test binary %q, %v", tmpBinary, err) ++ } ++ ++ cmd := exec.Command(tmpBinary) ++ cmd.Env = append(os.Environ(), "GO_DEATHSIG_PARENT=1") ++ chldStdin, err := cmd.StdinPipe() ++ if err != nil { ++ t.Fatalf("failed to create new stdin pipe: %v", err) ++ } ++ chldStdout, err := cmd.StdoutPipe() ++ if err != nil { ++ t.Fatalf("failed to create new stdout pipe: %v", err) ++ } ++ cmd.Stderr = os.Stderr ++ ++ err = cmd.Start() ++ defer cmd.Wait() ++ if err != nil { ++ t.Fatalf("failed to start first child process: %v", err) ++ } ++ ++ chldPipe := bufio.NewReader(chldStdout) ++ ++ if got, err := chldPipe.ReadString('\n'); got == "start\n" { ++ syscall.Kill(cmd.Process.Pid, syscall.SIGTERM) ++ ++ go func() { ++ time.Sleep(5 * time.Second) ++ chldStdin.Close() ++ }() ++ ++ want := "ok\n" ++ if got, err = chldPipe.ReadString('\n'); got != want { ++ t.Fatalf("expected %q, received %q, %v", want, got, err) ++ } ++ } else { ++ t.Fatalf("did not receive start from child, received %q, %v", got, err) ++ } ++} ++ ++func deathSignalParent() { ++ cmd := exec.Command(os.Args[0]) ++ cmd.Env = append(os.Environ(), ++ "GO_DEATHSIG_PARENT=", ++ "GO_DEATHSIG_CHILD=1", ++ ) ++ cmd.Stdin = os.Stdin ++ cmd.Stdout = os.Stdout ++ attrs := syscall.SysProcAttr{ ++ Pdeathsig: syscall.SIGUSR1, ++ // UID/GID 99 is the user/group "nobody" on RHEL/Fedora and is ++ // unused on Ubuntu ++ Credential: &syscall.Credential{Uid: 99, Gid: 99}, ++ } ++ cmd.SysProcAttr = &attrs ++ ++ err := cmd.Start() ++ if err != nil { ++ fmt.Fprintf(os.Stderr, "death signal parent error: %v\n", err) ++ os.Exit(1) ++ } ++ cmd.Wait() ++ os.Exit(0) ++} ++ ++func deathSignalChild() { ++ c := make(chan os.Signal, 1) ++ signal.Notify(c, syscall.SIGUSR1) ++ go func() { ++ <-c ++ fmt.Println("ok") ++ os.Exit(0) ++ }() ++ fmt.Println("start") ++ ++ buf := make([]byte, 32) ++ os.Stdin.Read(buf) ++ ++ // We expected to be signaled before stdin closed ++ fmt.Println("not ok") ++ os.Exit(1) ++} +diff --git a/src/syscall/syscall_freebsd_test.go b/src/syscall/syscall_freebsd_test.go +index 89c7959d0c..72cd133b85 100644 +--- a/src/syscall/syscall_freebsd_test.go ++++ b/src/syscall/syscall_freebsd_test.go +@@ -9,6 +9,7 @@ package syscall_test + + import ( + "fmt" ++ "os" + "syscall" + "testing" + "unsafe" +@@ -53,3 +54,13 @@ func TestConvertFromDirent11(t *testing.T) { + } + } + } ++ ++func TestMain(m *testing.M) { ++ if os.Getenv("GO_DEATHSIG_PARENT") == "1" { ++ deathSignalParent() ++ } else if os.Getenv("GO_DEATHSIG_CHILD") == "1" { ++ deathSignalChild() ++ } ++ ++ os.Exit(m.Run()) ++} +diff --git a/src/syscall/syscall_linux_test.go b/src/syscall/syscall_linux_test.go +index 442dc9f10e..8d828be015 100644 +--- a/src/syscall/syscall_linux_test.go ++++ b/src/syscall/syscall_linux_test.go +@@ -5,13 +5,11 @@ + package syscall_test + + import ( +- "bufio" + "fmt" + "io" + "io/fs" + "os" + "os/exec" +- "os/signal" + "path/filepath" + "runtime" + "sort" +@@ -19,7 +17,6 @@ import ( + "strings" + "syscall" + "testing" +- "time" + "unsafe" + ) + +@@ -153,120 +150,6 @@ func TestMain(m *testing.M) { + os.Exit(m.Run()) + } + +-func TestLinuxDeathSignal(t *testing.T) { +- if os.Getuid() != 0 { +- t.Skip("skipping root only test") +- } +- +- // Copy the test binary to a location that a non-root user can read/execute +- // after we drop privileges +- tempDir, err := os.MkdirTemp("", "TestDeathSignal") +- if err != nil { +- t.Fatalf("cannot create temporary directory: %v", err) +- } +- defer os.RemoveAll(tempDir) +- os.Chmod(tempDir, 0755) +- +- tmpBinary := filepath.Join(tempDir, filepath.Base(os.Args[0])) +- +- src, err := os.Open(os.Args[0]) +- if err != nil { +- t.Fatalf("cannot open binary %q, %v", os.Args[0], err) +- } +- defer src.Close() +- +- dst, err := os.OpenFile(tmpBinary, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0755) +- if err != nil { +- t.Fatalf("cannot create temporary binary %q, %v", tmpBinary, err) +- } +- if _, err := io.Copy(dst, src); err != nil { +- t.Fatalf("failed to copy test binary to %q, %v", tmpBinary, err) +- } +- err = dst.Close() +- if err != nil { +- t.Fatalf("failed to close test binary %q, %v", tmpBinary, err) +- } +- +- cmd := exec.Command(tmpBinary) +- cmd.Env = append(os.Environ(), "GO_DEATHSIG_PARENT=1") +- chldStdin, err := cmd.StdinPipe() +- if err != nil { +- t.Fatalf("failed to create new stdin pipe: %v", err) +- } +- chldStdout, err := cmd.StdoutPipe() +- if err != nil { +- t.Fatalf("failed to create new stdout pipe: %v", err) +- } +- cmd.Stderr = os.Stderr +- +- err = cmd.Start() +- defer cmd.Wait() +- if err != nil { +- t.Fatalf("failed to start first child process: %v", err) +- } +- +- chldPipe := bufio.NewReader(chldStdout) +- +- if got, err := chldPipe.ReadString('\n'); got == "start\n" { +- syscall.Kill(cmd.Process.Pid, syscall.SIGTERM) +- +- go func() { +- time.Sleep(5 * time.Second) +- chldStdin.Close() +- }() +- +- want := "ok\n" +- if got, err = chldPipe.ReadString('\n'); got != want { +- t.Fatalf("expected %q, received %q, %v", want, got, err) +- } +- } else { +- t.Fatalf("did not receive start from child, received %q, %v", got, err) +- } +-} +- +-func deathSignalParent() { +- cmd := exec.Command(os.Args[0]) +- cmd.Env = append(os.Environ(), +- "GO_DEATHSIG_PARENT=", +- "GO_DEATHSIG_CHILD=1", +- ) +- cmd.Stdin = os.Stdin +- cmd.Stdout = os.Stdout +- attrs := syscall.SysProcAttr{ +- Pdeathsig: syscall.SIGUSR1, +- // UID/GID 99 is the user/group "nobody" on RHEL/Fedora and is +- // unused on Ubuntu +- Credential: &syscall.Credential{Uid: 99, Gid: 99}, +- } +- cmd.SysProcAttr = &attrs +- +- err := cmd.Start() +- if err != nil { +- fmt.Fprintf(os.Stderr, "death signal parent error: %v\n", err) +- os.Exit(1) +- } +- cmd.Wait() +- os.Exit(0) +-} +- +-func deathSignalChild() { +- c := make(chan os.Signal, 1) +- signal.Notify(c, syscall.SIGUSR1) +- go func() { +- <-c +- fmt.Println("ok") +- os.Exit(0) +- }() +- fmt.Println("start") +- +- buf := make([]byte, 32) +- os.Stdin.Read(buf) +- +- // We expected to be signaled before stdin closed +- fmt.Println("not ok") +- os.Exit(1) +-} +- + func TestParseNetlinkMessage(t *testing.T) { + for i, b := range [][]byte{ + {103, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 11, 0, 1, 0, 0, 0, 0, 5, 8, 0, 3, +-- +2.33.0 + diff --git a/golang.spec b/golang.spec index c13d992..aab45ef 100644 --- a/golang.spec +++ b/golang.spec @@ -12,11 +12,6 @@ %define __find_requires %{nil} %bcond_with bootstrap -%ifarch x86_64 aarch64 riscv64 loongarch64 -%bcond_without ignore_tests -%else -%bcond_with ignore_tests -%endif %ifarch x86_64 aarch64 riscv64 loongarch64 %global external_linker 1 @@ -36,12 +31,6 @@ %global golang_bootstrap 1 %endif -%if %{with ignore_tests} -%global fail_on_tests 0 -%else -%global fail_on_tests 1 -%endif - %global shared 0 %ifarch x86_64 @@ -66,7 +55,7 @@ Name: golang Version: 1.17.3 -Release: 14 +Release: 15 Summary: The Go Programming Language License: BSD and Public Domain URL: https://golang.org/ @@ -187,6 +176,7 @@ Patch6026: 0026-release-branch.go1.17-regexp-syntax-reject-very-deep.patch Patch6027: 0027-release-branch.go1.17-net-http-update-bundled-golang.patch Patch6028: 0028-release-branch.go1.17-math-big-prevent-overflow-in-R.patch Patch6029: 0029-release-branch.go1.18-net-http-update-bundled-golang.patch +Patch6030: 0030-syscall-add-support-for-SysProcAttr.Pdeathsig-on-Fre.patch ExclusiveArch: %{golang_arches} @@ -384,11 +374,7 @@ export CGO_ENABLED=0 export GO_TEST_TIMEOUT_SCALE=2 -%if %{fail_on_tests} -echo tests ignored -%else -./run.bash --no-rebuild -v -v -v -k go_test:testing || : -%endif +./run.bash --no-rebuild -v -v -v -k -run=^go_test:? cd .. %post @@ -432,6 +418,9 @@ fi %files devel -f go-tests.list -f go-misc.list -f go-src.list %changelog +* Sat Feb 25 2023 hanchao - 1.17.3-15 +- Add golang package test + * Fri Jan 20 2023 hanchao - 1.17.3-14 - Type:CVE - CVE:CVE-2022-23806,CVE-2022-23773,CVE-2022-24921,CVE-2021-44716,CVE-2022-23772,CVE-2022-41717 -- Gitee