summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Lechner <felix.lechner@lease-up.com>2024-06-07 06:44:56 -0700
committerGuix Patches Tester <>2024-06-07 16:53:17 +0200
commit07290e3c8e40854e7121c20d9af2492472154610 (patch)
tree99e03c41e68ae889b6125dcdfde426c106ec7cfa
parent3ac7a10045abc357ca31eaeb2b2490ae26e96f6a (diff)
downloadguix-patches-issue-54165.tar
guix-patches-issue-54165.tar.gz
gnu: guile-bytestructures: add patch. (Closes: #54165)issue-54165
Adds the patch from a pull request recently submitted upstream. [1] The maintainer has not responded yet, so there could be further updates as time goes on. With this commit, nyacc 1.08.1 builds successfully.. [1] https://github.com/TaylanUB/scheme-bytestructures/pull/48 Change-Id: I8cd248e6e33efd36f54ca3b31c17badf54a863c5
-rw-r--r--gnu/packages/guile.scm3
-rw-r--r--gnu/packages/patches/guile-bytestructures-fix-54165.patch92
2 files changed, 94 insertions, 1 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 0bbd4a12ad..f7ef0dceff 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -796,7 +796,8 @@ Guile's foreign function interface.")
(file-name (git-file-name name version))
(sha256
(base32
- "1gnh3p2042cch1nkapl0p4pv20q7qs8cxvvbp7a5h1dwqbrkdyss"))))
+ "1gnh3p2042cch1nkapl0p4pv20q7qs8cxvvbp7a5h1dwqbrkdyss"))
+ (patches (search-patches "guile-bytestructures-fix-54165.patch"))))
(build-system gnu-build-system)
(arguments
`(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
diff --git a/gnu/packages/patches/guile-bytestructures-fix-54165.patch b/gnu/packages/patches/guile-bytestructures-fix-54165.patch
new file mode 100644
index 0000000000..b91ca36df4
--- /dev/null
+++ b/gnu/packages/patches/guile-bytestructures-fix-54165.patch
@@ -0,0 +1,92 @@
+From 5082cdd2529f13286509a525a28f9d9917456fc1 Mon Sep 17 00:00:00 2001
+From: Felix Lechner <felix.lechner@lease-up.com>
+Date: Fri, 7 Jun 2024 04:51:17 -0700
+Subject: [PATCH] Fix alignment in unpacked structs containing unions. (Closes:
+ #47)
+
+The 2.0.1 release suffered from a test failure [1] that caused some
+distributions to disable the test [2] but the underlying cause had yet
+to be identified.
+
+Based on a preliminary review of the code, the author of this commit
+believes there was a surplus line in the code [3] which is deleted
+here. This is the proposed evidence: The line shadowed the
+'alignment' variable in line immediately above it. [4] Then, the same
+expression was used two lines down below. [5] In combination, the line
+being removed here seems to have been left over from editing under
+time pressure. It may also have been added inadvertently.
+
+On GNU Guix, this commit fixes the 'ref1' test for aligned struct
+bytestructures containing union members, which was referenced via
+"run-tests.body.scm:194: FAIL ref1" in Ludo's original report. [6] The
+test output can be found at the bottom of this message.
+
+This commit closes Github issue #47. [7]
+
+[1] https://issues.guix.gnu.org/54165#1
+[2] https://github.com/alpinelinux/aports/commit/2d8604645ca38552343c61fbc65728a2881e6ddd
+[3] https://github.com/TaylanUB/scheme-bytestructures/blob/a6d5d25b26c0c5ef1f5fa38e2472fbf6a32cdf89/bytestructures/body/struct.scm#L110
+[4] https://github.com/TaylanUB/scheme-bytestructures/blob/a6d5d25b26c0c5ef1f5fa38e2472fbf6a32cdf89/bytestructures/body/struct.scm#L109
+[5] https://github.com/TaylanUB/scheme-bytestructures/blob/a6d5d25b26c0c5ef1f5fa38e2472fbf6a32cdf89/bytestructures/body/struct.scm#L112
+[6] https://github.com/TaylanUB/scheme-bytestructures/blob/a6d5d25b26c0c5ef1f5fa38e2472fbf6a32cdf89/run-tests.body.scm#L194
+[7] https://github.com/TaylanUB/scheme-bytestructures/issues/47
+
+* * *
+
+Group begin: aligned
+Test begin:
+ test-name: "ref1"
+ source-file: "run-tests.body.scm"
+ source-line: 194
+ source-form: (test-eqv "ref1" 321 (bytestructure-ref bs (quote a)))
+Test end:
+ result-kind: pass
+ actual-value: 321
+ expected-value: 321
+Test begin:
+ test-name: "ref2"
+ source-file: "run-tests.body.scm"
+ source-line: 196
+ source-form: (test-eqv "ref2" 456 (bytestructure-ref bs (quote b)))
+Test end:
+ result-kind: pass
+ actual-value: 456
+ expected-value: 456
+Test begin:
+ test-name: "set1"
+ source-file: "run-tests.body.scm"
+ source-line: 197
+ source-form: (test-eqv "set1" 789 (begin (bytestructure-set! bs (quote a) 789) (bytestructure-ref bs (quote a))))
+Test end:
+ result-kind: pass
+ actual-value: 789
+ expected-value: 789
+Test begin:
+ test-name: "set2"
+ source-file: "run-tests.body.scm"
+ source-line: 199
+ source-form: (test-eqv "set2" 987 (begin (bytestructure-set! bs (quote b) 987) (bytestructure-ref bs (quote b))))
+Test end:
+ result-kind: pass
+ actual-value: 987
+ expected-value: 987
+Group end: aligned
+---
+ bytestructures/body/struct.scm | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/bytestructures/body/struct.scm b/bytestructures/body/struct.scm
+index 07797b5..0113a17 100644
+--- a/bytestructures/body/struct.scm
++++ b/bytestructures/body/struct.scm
+@@ -107,7 +107,6 @@
+ (let ((descriptor (cadr field-spec)))
+ (bytestructure-descriptor-size descriptor)))
+ (let* ((alignment (apply max (map field-spec-alignment field-specs)))
+- (alignment (pack-alignment pack alignment))
+ (size (apply max (map field-spec-size field-specs)))
+ (position (align position size (pack-alignment pack alignment))))
+ (let loop ((field-specs field-specs)
+--
+2.41.0
+