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 --- .../patches/go-gopkg-in-yaml-v3-32bit.patch | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch (limited to 'gnu/packages/patches') 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