gnu: go-gopkg-in-yaml-v3: Fix build on 32-bit systems.

* gnu/packages/golang.scm (go-gopkg-in-yaml-v3)[source]: Add patch.
* gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: Ia8a96b15d37a3d2f133da9374cac1e58e38f2d2c
This commit is contained in:
Efraim Flashner 2023-11-24 10:32:54 +02:00
parent 0083a22659
commit d25e9f440b
No known key found for this signature in database
GPG Key ID: 41AAE7DCCA3D8351
3 changed files with 53 additions and 1 deletions

View File

@ -1342,6 +1342,7 @@ dist_patch_DATA = \
%D%/packages/patches/gobject-introspection-cc-1.72.patch \
%D%/packages/patches/gobject-introspection-girepository.patch \
%D%/packages/patches/go-fix-script-tests.patch \
%D%/packages/patches/go-gopkg-in-yaml-v3-32bit.patch \
%D%/packages/patches/go-github-com-golang-snappy-32bit-test.patch \
%D%/packages/patches/go-github-com-urfave-cli-fix-tests.patch \
%D%/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch \

View File

@ -5577,7 +5577,8 @@ values.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "01b0wjb7yzv8wzzz2iim8mjpkwjnykcanrwiq06pkl89lr6gv8hn"))))
(base32 "01b0wjb7yzv8wzzz2iim8mjpkwjnykcanrwiq06pkl89lr6gv8hn"))
(patches (search-patches "go-gopkg-in-yaml-v3-32bit.patch"))))
(build-system go-build-system)
(arguments
'(#:import-path "gopkg.in/yaml.v3"))

View File

@ -0,0 +1,50 @@
https://sources.debian.org/src/golang-gopkg-yaml.v3/3.0.1-3/debian/patches/0001-Fix-0b-on-32-bit-systems.patch/
From: Shengjing Zhu <zhsj@debian.org>
Date: Fri, 16 Apr 2021 00:40:09 +0800
Subject: Fix -0b on 32-bit systems
Origin: backport, https://github.com/go-yaml/yaml/pull/442
---
decode_test.go | 7 ++++---
resolve.go | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/decode_test.go b/decode_test.go
index 51f5070..9cac74c 100644
--- a/decode_test.go
+++ b/decode_test.go
@@ -175,9 +175,6 @@ var unmarshalTests = []struct {
}, {
"bin: -0b101010",
map[string]interface{}{"bin": -42},
- }, {
- "bin: -0b1000000000000000000000000000000000000000000000000000000000000000",
- map[string]interface{}{"bin": -9223372036854775808},
}, {
"decimal: +685_230",
map[string]int{"decimal": 685230},
@@ -357,6 +354,10 @@ var unmarshalTests = []struct {
"int64_min: -9223372036854775808",
map[string]int64{"int64_min": math.MinInt64},
},
+ {
+ "int64_min_base2: -0b1000000000000000000000000000000000000000000000000000000000000000",
+ map[string]int64{"int64_min_base2": math.MinInt64},
+ },
{
"int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111",
map[string]int64{"int64_neg_base2": -math.MaxInt64},
diff --git a/resolve.go b/resolve.go
index 64ae888..1b7d8c3 100644
--- a/resolve.go
+++ b/resolve.go
@@ -223,7 +223,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) {
} else if strings.HasPrefix(plain, "-0b") {
intv, err := strconv.ParseInt("-"+plain[3:], 2, 64)
if err == nil {
- if true || intv == int64(int(intv)) {
+ if intv == int64(int(intv)) {
return intTag, int(intv)
} else {
return intTag, intv