!283 update: update to go1.21.4
From: @hcnbxx Reviewed-by: @zhangsong234, @jing-rui Signed-off-by: @jing-rui
This commit is contained in:
commit
330b9ef9fb
@ -1,40 +0,0 @@
|
|||||||
From 57777dcbc3d05c12ac2b227e7afd5435bf84128c Mon Sep 17 00:00:00 2001
|
|
||||||
From: hanchao <hanchao63@huawei.com>
|
|
||||||
Date: Mon, 3 Jul 2023 21:20:32 +0800
|
|
||||||
Subject: [PATCH] Enable go plugin support for riscv64 (based on work by
|
|
||||||
yangjinghua)
|
|
||||||
|
|
||||||
---
|
|
||||||
src/cmd/link/internal/ld/config.go | 2 +-
|
|
||||||
src/internal/platform/supported.go | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go
|
|
||||||
index ba74b6f..836c10d 100644
|
|
||||||
--- a/src/cmd/link/internal/ld/config.go
|
|
||||||
+++ b/src/cmd/link/internal/ld/config.go
|
|
||||||
@@ -84,7 +84,7 @@ func (mode *BuildMode) Set(s string) error {
|
|
||||||
switch buildcfg.GOOS {
|
|
||||||
case "linux":
|
|
||||||
switch buildcfg.GOARCH {
|
|
||||||
- case "386", "amd64", "arm", "arm64", "ppc64le", "s390x":
|
|
||||||
+ case "386", "amd64", "arm", "arm64", "riscv64", "ppc64le", "s390x":
|
|
||||||
default:
|
|
||||||
return badmode()
|
|
||||||
}
|
|
||||||
diff --git a/src/internal/platform/supported.go b/src/internal/platform/supported.go
|
|
||||||
index 046352f..644822f 100644
|
|
||||||
--- a/src/internal/platform/supported.go
|
|
||||||
+++ b/src/internal/platform/supported.go
|
|
||||||
@@ -180,7 +180,7 @@ func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
|
|
||||||
|
|
||||||
case "plugin":
|
|
||||||
switch platform {
|
|
||||||
- case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x", "linux/ppc64le",
|
|
||||||
+ case "linux/amd64", "linux/arm", "linux/arm64", "linux/riscv64", "linux/386", "linux/s390x", "linux/ppc64le",
|
|
||||||
"android/amd64", "android/arm", "android/arm64", "android/386",
|
|
||||||
"darwin/amd64", "darwin/arm64",
|
|
||||||
"freebsd/amd64":
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
--- go/src/cmd/go/internal/cfg/cfg.go.orig 2023-07-30 20:09:07.754216000 +0800
|
|
||||||
+++ go/src/cmd/go/internal/cfg/cfg.go 2023-07-30 20:09:46.037239800 +0800
|
|
||||||
@@ -383,8 +383,8 @@
|
|
||||||
GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", buildcfg.GOPPC64))
|
|
||||||
GOWASM = envOr("GOWASM", fmt.Sprint(buildcfg.GOWASM))
|
|
||||||
|
|
||||||
- GOPROXY = envOr("GOPROXY", "https://proxy.golang.org,direct")
|
|
||||||
- GOSUMDB = envOr("GOSUMDB", "sum.golang.org")
|
|
||||||
+ GOPROXY = envOr("GOPROXY", "https://repo.huaweicloud.com/repository/goproxy/,direct")
|
|
||||||
+ GOSUMDB = envOr("GOSUMDB", "sum.golang.google.cn")
|
|
||||||
GOPRIVATE = Getenv("GOPRIVATE")
|
|
||||||
GONOPROXY = envOr("GONOPROXY", GOPRIVATE)
|
|
||||||
GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE)
|
|
||||||
--- go/src/cmd/go/testdata/script/mod_sumdb_golang.txt.orig 2023-07-30 20:09:55.992971800 +0800
|
|
||||||
+++ go/src/cmd/go/testdata/script/mod_sumdb_golang.txt 2023-07-30 20:10:32.184846600 +0800
|
|
||||||
@@ -2,12 +2,12 @@
|
|
||||||
env GOPROXY=
|
|
||||||
env GOSUMDB=
|
|
||||||
go env GOPROXY
|
|
||||||
-stdout '^https://proxy.golang.org,direct$'
|
|
||||||
+stdout '^https://repo.huaweicloud.com/repository/goproxy/,direct$'
|
|
||||||
go env GOSUMDB
|
|
||||||
-stdout '^sum.golang.org$'
|
|
||||||
+stdout '^sum.golang.google.cn$'
|
|
||||||
env GOPROXY=https://proxy.golang.org
|
|
||||||
go env GOSUMDB
|
|
||||||
-stdout '^sum.golang.org$'
|
|
||||||
+stdout '^sum.golang.google.cn$'
|
|
||||||
|
|
||||||
# Download direct from github.
|
|
||||||
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
From b9153f6ef338baee5fe02a867c8fbc83a8b29dd1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Damien Neil <dneil@google.com>
|
|
||||||
Date: Wed, 19 Jul 2023 10:30:46 -0700
|
|
||||||
Subject: [PATCH] net/http: permit requests with invalid Host headers
|
|
||||||
|
|
||||||
Historically, the Transport has silently truncated invalid
|
|
||||||
Host headers at the first '/' or ' ' character. CL 506996 changed
|
|
||||||
this behavior to reject invalid Host headers entirely.
|
|
||||||
Unfortunately, Docker appears to rely on the previous behavior.
|
|
||||||
|
|
||||||
When sending a HTTP/1 request with an invalid Host, send an empty
|
|
||||||
Host header. This is safer than truncation: If you care about the
|
|
||||||
Host, then you should get the one you set; if you don't care,
|
|
||||||
then an empty Host should be fine.
|
|
||||||
|
|
||||||
Continue to fully validate Host headers sent to a proxy,
|
|
||||||
since proxies generally can't productively forward requests
|
|
||||||
without a Host.
|
|
||||||
|
|
||||||
For #60374
|
|
||||||
Fixes #61431
|
|
||||||
|
|
||||||
Change-Id: If170c7dd860aa20eb58fe32990fc93af832742b6
|
|
||||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/511155
|
|
||||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
|
||||||
Reviewed-by: Roland Shoemaker <roland@golang.org>
|
|
||||||
Run-TryBot: Damien Neil <dneil@google.com>
|
|
||||||
---
|
|
||||||
src/net/http/request.go | 23 ++++++++++++++++++++++-
|
|
||||||
src/net/http/request_test.go | 17 ++++++++++++-----
|
|
||||||
2 files changed, 34 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/net/http/request.go b/src/net/http/request.go
|
|
||||||
index a2e8373dd5..d1fbd5df90 100644
|
|
||||||
--- a/src/net/http/request.go
|
|
||||||
+++ b/src/net/http/request.go
|
|
||||||
@@ -591,8 +591,29 @@ func (r *Request) write(w io.Writer, usingProxy bool, extraHeaders Header, waitF
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
+ // Validate that the Host header is a valid header in general,
|
|
||||||
+ // but don't validate the host itself. This is sufficient to avoid
|
|
||||||
+ // header or request smuggling via the Host field.
|
|
||||||
+ // The server can (and will, if it's a net/http server) reject
|
|
||||||
+ // the request if it doesn't consider the host valid.
|
|
||||||
if !httpguts.ValidHostHeader(host) {
|
|
||||||
- return errors.New("http: invalid Host header")
|
|
||||||
+ // Historically, we would truncate the Host header after '/' or ' '.
|
|
||||||
+ // Some users have relied on this truncation to convert a network
|
|
||||||
+ // address such as Unix domain socket path into a valid, ignored
|
|
||||||
+ // Host header (see https://go.dev/issue/61431).
|
|
||||||
+ //
|
|
||||||
+ // We don't preserve the truncation, because sending an altered
|
|
||||||
+ // header field opens a smuggling vector. Instead, zero out the
|
|
||||||
+ // Host header entirely if it isn't valid. (An empty Host is valid;
|
|
||||||
+ // see RFC 9112 Section 3.2.)
|
|
||||||
+ //
|
|
||||||
+ // Return an error if we're sending to a proxy, since the proxy
|
|
||||||
+ // probably can't do anything useful with an empty Host header.
|
|
||||||
+ if !usingProxy {
|
|
||||||
+ host = ""
|
|
||||||
+ } else {
|
|
||||||
+ return errors.New("http: invalid Host header")
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
// According to RFC 6874, an HTTP client, proxy, or other
|
|
||||||
diff --git a/src/net/http/request_test.go b/src/net/http/request_test.go
|
|
||||||
index 0892bc255f..a32b583c11 100644
|
|
||||||
--- a/src/net/http/request_test.go
|
|
||||||
+++ b/src/net/http/request_test.go
|
|
||||||
@@ -767,16 +767,23 @@ func TestRequestWriteBufferedWriter(t *testing.T) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-func TestRequestBadHost(t *testing.T) {
|
|
||||||
+func TestRequestBadHostHeader(t *testing.T) {
|
|
||||||
got := []string{}
|
|
||||||
req, err := NewRequest("GET", "http://foo/after", nil)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
- req.Host = "foo.com with spaces"
|
|
||||||
- req.URL.Host = "foo.com with spaces"
|
|
||||||
- if err := req.Write(logWrites{t, &got}); err == nil {
|
|
||||||
- t.Errorf("Writing request with invalid Host: succeded, want error")
|
|
||||||
+ req.Host = "foo.com\nnewline"
|
|
||||||
+ req.URL.Host = "foo.com\nnewline"
|
|
||||||
+ req.Write(logWrites{t, &got})
|
|
||||||
+ want := []string{
|
|
||||||
+ "GET /after HTTP/1.1\r\n",
|
|
||||||
+ "Host: \r\n",
|
|
||||||
+ "User-Agent: " + DefaultUserAgent + "\r\n",
|
|
||||||
+ "\r\n",
|
|
||||||
+ }
|
|
||||||
+ if !reflect.DeepEqual(got, want) {
|
|
||||||
+ t.Errorf("Writes = %q\n Want = %q", got, want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
Binary file not shown.
28
golang.spec
28
golang.spec
@ -59,8 +59,8 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: golang
|
Name: golang
|
||||||
Version: 1.20.7
|
Version: 1.21.4
|
||||||
Release: 2
|
Release: 1
|
||||||
Summary: The Go Programming Language
|
Summary: The Go Programming Language
|
||||||
License: BSD and Public Domain
|
License: BSD and Public Domain
|
||||||
URL: https://golang.org/
|
URL: https://golang.org/
|
||||||
@ -95,15 +95,15 @@ Recommends: glibc gcc git subversion
|
|||||||
# - in version filed substituted with . per versioning guidelines
|
# - in version filed substituted with . per versioning guidelines
|
||||||
Provides: bundled(golang(github.com/google/pprof)) = 0.0.0.20221118152302.e6195bd50e26
|
Provides: bundled(golang(github.com/google/pprof)) = 0.0.0.20221118152302.e6195bd50e26
|
||||||
Provides: bundled(golang(github.com/ianlancetaylor/demangle)) = 0.0.0.20220319035150.800ac71e25c2
|
Provides: bundled(golang(github.com/ianlancetaylor/demangle)) = 0.0.0.20220319035150.800ac71e25c2
|
||||||
Provides: bundled(golang(golang.org/x/arch)) = 0.1.1.0.20221116201807.1bb480fc256a
|
Provides: bundled(golang(golang.org/x/arch)) = 0.4.0
|
||||||
Provides: bundled(golang(golang.org/x/crypto)) = 0.3.1.0.20221117191849.2c476679df9a
|
Provides: bundled(golang(golang.org/x/crypto)) = 0.11.1.0.20230711161743.2e82bdd1719d
|
||||||
Provides: bundled(golang(golang.org/x/mod)) = 0.7.0
|
Provides: bundled(golang(golang.org/x/mod)) = 0.12.0
|
||||||
Provides: bundled(golang(golang.org/x/net)) = 0.4.1.0.20230214201333.88ed8ca3307d
|
Provides: bundled(golang(golang.org/x/net)) = 0.12.1.0.20231027154334.5ca955b1789c
|
||||||
Provides: bundled(golang(golang.org/x/sync)) = 0.1.0
|
Provides: bundled(golang(golang.org/x/sync)) = 0.3.0
|
||||||
Provides: bundled(golang(golang.org/x/sys)) = 0.3.0
|
Provides: bundled(golang(golang.org/x/sys)) = 0.10.0
|
||||||
Provides: bundled(golang(golang.org/x/term)) = 0.2.0
|
Provides: bundled(golang(golang.org/x/term)) = 0.10.0
|
||||||
Provides: bundled(golang(golang.org/x/text)) = 0.5.0
|
Provides: bundled(golang(golang.org/x/text)) = 0.11.0
|
||||||
Provides: bundled(golang(golang.org/x/tools)) = 0.3.1.0.20230118190848.070db2996ebe
|
Provides: bundled(golang(golang.org/x/tools)) = 0.11.1.0.20230712164437.1ca21856af7b
|
||||||
|
|
||||||
Provides: %{name}-bin = %{version}-%{release}
|
Provides: %{name}-bin = %{version}-%{release}
|
||||||
Obsoletes: %{name}-bin
|
Obsoletes: %{name}-bin
|
||||||
@ -114,9 +114,6 @@ Obsoletes: %{name}-vim < 1.4
|
|||||||
Obsoletes: emacs-%{name} < 1.4
|
Obsoletes: emacs-%{name} < 1.4
|
||||||
Requires: %{vendor}-rpm-config
|
Requires: %{vendor}-rpm-config
|
||||||
|
|
||||||
Patch6001: 0001-Enable-go-plugin-support-for-riscv64-based-on-work-b.patch
|
|
||||||
Patch6002: 0002-cmd-go-use-local-proxy-and-sumdb.patch
|
|
||||||
Patch6003: 0003-net-http-permit-requests-with-invalid-Host-headers.patch
|
|
||||||
ExclusiveArch: %{golang_arches}
|
ExclusiveArch: %{golang_arches}
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -354,6 +351,9 @@ fi
|
|||||||
%files devel -f go-tests.list -f go-misc.list -f go-src.list
|
%files devel -f go-tests.list -f go-misc.list -f go-src.list
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 5 2023 hanchao <hanchao63@huawei.com> - 1.21.4-1
|
||||||
|
- upgrade to 1.21.4
|
||||||
|
|
||||||
* Thu Aug 24 2023 wanglimin <wanglimin@xfusion.com> - 1.20.7-2
|
* Thu Aug 24 2023 wanglimin <wanglimin@xfusion.com> - 1.20.7-2
|
||||||
- permit invalid host header for docker
|
- permit invalid host header for docker
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user