From d25e9f440b15882af1a45057ff65616162de8201 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Fri, 24 Nov 2023 10:32:54 +0200 Subject: 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 --- gnu/local.mk | 1 + gnu/packages/golang.scm | 3 +- .../patches/go-gopkg-in-yaml-v3-32bit.patch | 50 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch diff --git a/gnu/local.mk b/gnu/local.mk index db9d6b93a4..023cd4b17f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -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 \ diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index 9c707e5414..2c9aff4a28 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -5577,7 +5577,8 @@ (define-public go-gopkg-in-yaml-v3 (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")) diff --git a/gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch b/gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch new file mode 100644 index 0000000000..7a243f5d80 --- /dev/null +++ b/gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch @@ -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 +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 -- cgit v1.2.3