New package: go1.20-1.20.7

This commit is contained in:
Đoàn Trần Công Danh 2023-08-24 20:59:45 +07:00
parent 543e123d7f
commit e0a00298e8
5 changed files with 313 additions and 0 deletions

View File

@ -0,0 +1,13 @@
Fixes go1.19 error on i686 -
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
--- a/go/src/cmd/go/script_test.go
+++ b/go/src/cmd/go/script_test.go
@@ -148,6 +148,7 @@ var extraEnvKeys = []string{
"GO_TESTING_GOTOOLS", // for gccgo testing
"GCCGO", // for gccgo testing
"GCCGOTOOLDIR", // for gccgo testing
+ "CGO_CFLAGS", // for working around go1.19 "unknown symbol __stack_chk_fail_local" error on x86
}
// setup sets up the test execution temporary directory and environment.

View File

@ -0,0 +1,29 @@
These tests fail on musl because /proc/../status doesn't contain the "Groups"
field, because musl lacks the getgroups() syscall.
--- a/go/src/syscall/syscall_linux_test.go
+++ b/go/src/syscall/syscall_linux_test.go
@@ -530,10 +530,6 @@ func TestSetuidEtc(t *testing.T) {
{call: "Setgid(1)", fn: func() error { return syscall.Setgid(1) }, filter: "Gid:", expect: "\t1\t1\t1\t1"},
{call: "Setgid(0)", fn: func() error { return syscall.Setgid(0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},
- {call: "Setgroups([]int{0,1,2,3})", fn: func() error { return syscall.Setgroups([]int{0, 1, 2, 3}) }, filter: "Groups:", expect: "\t0 1 2 3"},
- {call: "Setgroups(nil)", fn: func() error { return syscall.Setgroups(nil) }, filter: "Groups:", expect: ""},
- {call: "Setgroups([]int{0})", fn: func() error { return syscall.Setgroups([]int{0}) }, filter: "Groups:", expect: "\t0"},
-
{call: "Setregid(101,0)", fn: func() error { return syscall.Setregid(101, 0) }, filter: "Gid:", expect: "\t101\t0\t0\t0"},
{call: "Setregid(0,102)", fn: func() error { return syscall.Setregid(0, 102) }, filter: "Gid:", expect: "\t0\t102\t102\t102"},
{call: "Setregid(0,0)", fn: func() error { return syscall.Setregid(0, 0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},
--- a/go/misc/cgo/test/issue1435.go
+++ b/go/misc/cgo/test/issue1435.go
@@ -165,10 +165,6 @@ func test1435(t *testing.T) {
{call: "Setgid(1)", fn: func() error { return syscall.Setgid(1) }, filter: "Gid:", expect: "\t1\t1\t1\t1"},
{call: "Setgid(0)", fn: func() error { return syscall.Setgid(0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},
- {call: "Setgroups([]int{0,1,2,3})", fn: func() error { return syscall.Setgroups([]int{0, 1, 2, 3}) }, filter: "Groups:", expect: "\t0 1 2 3"},
- {call: "Setgroups(nil)", fn: func() error { return syscall.Setgroups(nil) }, filter: "Groups:", expect: ""},
- {call: "Setgroups([]int{0})", fn: func() error { return syscall.Setgroups([]int{0}) }, filter: "Groups:", expect: "\t0"},
-
{call: "Setregid(101,0)", fn: func() error { return syscall.Setregid(101, 0) }, filter: "Gid:", expect: "\t101\t0\t0\t0"},
{call: "Setregid(0,102)", fn: func() error { return syscall.Setregid(0, 102) }, filter: "Gid:", expect: "\t0\t102\t102\t102"},
{call: "Setregid(0,0)", fn: func() error { return syscall.Setregid(0, 0) }, filter: "Gid:", expect: "\t0\t0\t0\t0"},

View File

@ -0,0 +1,150 @@
Inside user namespaces, if GID == OVERFLOWGID (65534), then chown won't work.
https://github.com/golang/go/issues/42525
--- a/go/src/os/os_unix_test.go
+++ b/go/src/os/os_unix_test.go
@@ -39,144 +39,6 @@ func checkUidGid(t *testing.T, path string, uid, gid int) {
}
}
-func TestChown(t *testing.T) {
- // Use TempDir() to make sure we're on a local file system,
- // so that the group ids returned by Getgroups will be allowed
- // on the file. On NFS, the Getgroups groups are
- // basically useless.
- f := newFile("TestChown", t)
- defer Remove(f.Name())
- defer f.Close()
- dir, err := f.Stat()
- if err != nil {
- t.Fatalf("stat %s: %s", f.Name(), err)
- }
-
- // Can't change uid unless root, but can try
- // changing the group id. First try our current group.
- gid := Getgid()
- t.Log("gid:", gid)
- if err = Chown(f.Name(), -1, gid); err != nil {
- t.Fatalf("chown %s -1 %d: %s", f.Name(), gid, err)
- }
- sys := dir.Sys().(*syscall.Stat_t)
- checkUidGid(t, f.Name(), int(sys.Uid), gid)
-
- // Then try all the auxiliary groups.
- groups, err := Getgroups()
- if err != nil {
- t.Fatalf("getgroups: %s", err)
- }
- t.Log("groups: ", groups)
- for _, g := range groups {
- if err = Chown(f.Name(), -1, g); err != nil {
- t.Fatalf("chown %s -1 %d: %s", f.Name(), g, err)
- }
- checkUidGid(t, f.Name(), int(sys.Uid), g)
-
- // change back to gid to test fd.Chown
- if err = f.Chown(-1, gid); err != nil {
- t.Fatalf("fchown %s -1 %d: %s", f.Name(), gid, err)
- }
- checkUidGid(t, f.Name(), int(sys.Uid), gid)
- }
-}
-
-func TestFileChown(t *testing.T) {
- // Use TempDir() to make sure we're on a local file system,
- // so that the group ids returned by Getgroups will be allowed
- // on the file. On NFS, the Getgroups groups are
- // basically useless.
- f := newFile("TestFileChown", t)
- defer Remove(f.Name())
- defer f.Close()
- dir, err := f.Stat()
- if err != nil {
- t.Fatalf("stat %s: %s", f.Name(), err)
- }
-
- // Can't change uid unless root, but can try
- // changing the group id. First try our current group.
- gid := Getgid()
- t.Log("gid:", gid)
- if err = f.Chown(-1, gid); err != nil {
- t.Fatalf("fchown %s -1 %d: %s", f.Name(), gid, err)
- }
- sys := dir.Sys().(*syscall.Stat_t)
- checkUidGid(t, f.Name(), int(sys.Uid), gid)
-
- // Then try all the auxiliary groups.
- groups, err := Getgroups()
- if err != nil {
- t.Fatalf("getgroups: %s", err)
- }
- t.Log("groups: ", groups)
- for _, g := range groups {
- if err = f.Chown(-1, g); err != nil {
- t.Fatalf("fchown %s -1 %d: %s", f.Name(), g, err)
- }
- checkUidGid(t, f.Name(), int(sys.Uid), g)
-
- // change back to gid to test fd.Chown
- if err = f.Chown(-1, gid); err != nil {
- t.Fatalf("fchown %s -1 %d: %s", f.Name(), gid, err)
- }
- checkUidGid(t, f.Name(), int(sys.Uid), gid)
- }
-}
-
-func TestLchown(t *testing.T) {
- // Use TempDir() to make sure we're on a local file system,
- // so that the group ids returned by Getgroups will be allowed
- // on the file. On NFS, the Getgroups groups are
- // basically useless.
- f := newFile("TestLchown", t)
- defer Remove(f.Name())
- defer f.Close()
- dir, err := f.Stat()
- if err != nil {
- t.Fatalf("stat %s: %s", f.Name(), err)
- }
-
- linkname := f.Name() + "2"
- if err := Symlink(f.Name(), linkname); err != nil {
- if runtime.GOOS == "android" && IsPermission(err) {
- t.Skip("skipping test on Android; permission error creating symlink")
- }
- t.Fatalf("link %s -> %s: %v", f.Name(), linkname, err)
- }
- defer Remove(linkname)
-
- // Can't change uid unless root, but can try
- // changing the group id. First try our current group.
- gid := Getgid()
- t.Log("gid:", gid)
- if err = Lchown(linkname, -1, gid); err != nil {
- if err, ok := err.(*PathError); ok && err.Err == syscall.ENOSYS {
- t.Skip("lchown is unavailable")
- }
- t.Fatalf("lchown %s -1 %d: %s", linkname, gid, err)
- }
- sys := dir.Sys().(*syscall.Stat_t)
- checkUidGid(t, linkname, int(sys.Uid), gid)
-
- // Then try all the auxiliary groups.
- groups, err := Getgroups()
- if err != nil {
- t.Fatalf("getgroups: %s", err)
- }
- t.Log("groups: ", groups)
- for _, g := range groups {
- if err = Lchown(linkname, -1, g); err != nil {
- t.Fatalf("lchown %s -1 %d: %s", linkname, g, err)
- }
- checkUidGid(t, linkname, int(sys.Uid), g)
-
- // Check that link target's gid is unchanged.
- checkUidGid(t, f.Name(), int(sys.Uid), int(sys.Gid))
- }
-}
-
// Issue 16919: Readdir must return a non-empty slice or an error.
func TestReaddirRemoveRace(t *testing.T) {
oldStat := *LstatP

120
srcpkgs/go1.20/template Normal file
View File

@ -0,0 +1,120 @@
# Template file for 'go1.20'
pkgname=go1.20
version=1.20.7
revision=1
create_wrksrc=yes
build_wrksrc=go
hostmakedepends="go1.17-bootstrap"
checkdepends="iana-etc clang gcc-fortran"
short_desc="Go Programming Language"
maintainer="Michael Aldridge <maldridge@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://go.dev/"
changelog="https://go.dev/doc/devel/release.html"
distfiles="https://go.dev/dl/go${version}.src.tar.gz"
checksum=2c5ee9c9ec1e733b0dbbc2bdfed3f62306e51d8172bf38f4f4e542b27520f597
nostrip=yes
noverifyrdeps=yes
# on CI it tries to use `git submodule`, which is not part of chroot-git
make_check=ci-skip
case "${XBPS_TARGET_MACHINE}" in
aarch64*) _goarch=arm64 ;;
arm*) _goarch=arm ;;
i686*) _goarch=386 ;;
x86_64*) _goarch=amd64 ;;
ppc64le*) _goarch=ppc64le ;;
mips*) _goarch=mips ;;
*) broken="Unsupported architecture ${XBPS_TARGET_MACHINE}" ;;
esac
if [ "$CROSS_BUILD" ]; then
if [ "${XBPS_MACHINE%%-musl}" = "${XBPS_TARGET_MACHINE%%-musl}" ]; then
broken="Cross-compiling to different libc is not supported"
fi
fi
# Workaround for go-1.19 compilation error on i686
# runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
if [ "$XBPS_MACHINE" = i686 ]; then
export CGO_CFLAGS="-fno-stack-protector"
fi
post_extract() {
if [ "$(df . --output=fstype | tail -1)" = zfs ]; then
# https://github.com/golang/go/issues/39905
rm -v go/src/cmd/link/internal/ld/fallocate_test.go
fi
}
do_build() {
unset GCC CC CXX LD CFLAGS
# FIXME: work around leaking go build-style vars when built as a
# dependency
unset CGO_CXXFLAGS CGO_ENABLED # CGO_CFLAGS
export GOROOT_BOOTSTRAP="/usr/lib/go1.17.13"
export GOROOT=$PWD
export GOROOT_FINAL="/usr/lib/${pkgname}"
export GOARCH=${_goarch}
cd "src"
bash make.bash -v
}
do_check() {
if [ "$XBPS_LIBC" = musl ]; then
# https://github.com/golang/go/issues/39857
./bin/go tool dist test -v -run "!^cgo_test$"
else
./bin/go tool dist test -v
fi
}
do_install() {
local bindir _f _fname
if [ "$CROSS_BUILD" ]; then
bindir=bin/linux_${_goarch}
else
bindir=bin
fi
vmkdir usr/bin
vmkdir usr/lib/${pkgname}/bin
vmkdir usr/share/${pkgname}
cp -d --preserve=all ${bindir}/* ${DESTDIR}/usr/lib/${pkgname}/bin || true
cp -a pkg src lib ${DESTDIR}/usr/lib/${pkgname}
cp -r doc misc -t ${DESTDIR}/usr/share/${pkgname}
ln -sfr ${DESTDIR}/usr/share/${pkgname}/doc \
${DESTDIR}/usr/lib/${pkgname}/doc
cp VERSION ${DESTDIR}/usr/lib/${pkgname}/VERSION
# This is to make go get code.google.com/p/go-tour/gotour and
# then running the gotour executable work out of the box.
#
# Also, /usr/bin is the place for system-wide executables,
# not /usr/lib/go/bin. Users should use different paths by
# setting the appropriate environment variables.
#
for _f in ${DESTDIR}/usr/lib/${pkgname}/bin/*; do
if [ -f "$_f" ]; then
_fname=${_f##*/}
ln -sf "../lib/${pkgname}/bin/$_fname" \
"${DESTDIR}/usr/bin/${_fname}1.20"
fi
done
# <dominikh> sigh. well, someone fix the template and add
# a symlink, usr/lib/go/misc -> /usr/share/go/misc
ln -sfr ${DESTDIR}/usr/share/${pkgname}/misc \
${DESTDIR}/usr/lib/${pkgname}/misc
rm -f ${DESTDIR}/usr/share/${pkgname}/doc/articles/wiki/get.bin
rm -f ${DESTDIR}/usr/lib/${pkgname}/pkg/tool/*/api
rm -rf ${DESTDIR}/usr/lib/${pkgname}/pkg/bootstrap
rm -rf ${DESTDIR}/usr/lib/${pkgname}/pkg/obj
vlicense LICENSE
}

1
srcpkgs/go1.20/update Normal file
View File

@ -0,0 +1 @@
ignore="*beta* *rc*"