[packages/http-parser] Rel 3; x32 fix

arekm arekm at pld-linux.org
Sun Aug 23 15:13:56 CEST 2026


commit 863cf754825291f7cc2a867eb4cbfd51c9816200
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Aug 23 15:13:48 2026 +0200

    Rel 3; x32 fix

 http-parser-sizeof-assert.patch | 22 ++++++++++++++++++++++
 http-parser.spec                |  4 +++-
 2 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/http-parser.spec b/http-parser.spec
index a51f7e4..f154424 100644
--- a/http-parser.spec
+++ b/http-parser.spec
@@ -6,13 +6,14 @@ Summary:	HTTP request/response parser for C
 Summary(pl.UTF-8):	Analizator żądań/odpowiedzi HTTP dla C
 Name:		http-parser
 Version:	2.9.4
-Release:	2
+Release:	3
 License:	MIT
 Group:		Libraries
 #Source0Download: https://github.com/nodejs/http-parser/releases
 # upstream archived in 2020, 2.9.4 is the final release
 Source0:	https://github.com/nodejs/http-parser/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	1b0f2371aabacbadaa03cc532cedcf92
+Patch0:		%{name}-sizeof-assert.patch
 URL:		https://github.com/nodejs/http-parser
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -53,6 +54,7 @@ Pliki nagłówkowe biblioteki http-parser.
 
 %prep
 %setup -q
+%patch -P0 -p1
 
 %build
 export CPPFLAGS="%{rpmcppflags}"
diff --git a/http-parser-sizeof-assert.patch b/http-parser-sizeof-assert.patch
new file mode 100644
index 0000000..cd476db
--- /dev/null
+++ b/http-parser-sizeof-assert.patch
@@ -0,0 +1,22 @@
+Fix the sizeof(http_parser) assertion on ABIs that tail-pad the struct.
+
+test.c asserts that sizeof(http_parser) equals the plain sum of its member
+sizes, which only holds when the struct needs no tail padding.  On x32
+pointers are 4 bytes while uint64_t is still 8-byte aligned, so the struct is
+8-byte aligned and padded out from 28 to 32 bytes, and the assertion aborts
+the test run.  Round the member sum up to the struct's alignment instead.
+
+--- http-parser-2.9.4.orig/test.c	2020-03-24 11:54:06.000000000 +0100
++++ http-parser-2.9.4/test.c	2026-08-23 15:00:21.685328651 +0200
+@@ -4221,7 +4221,10 @@
+   printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version);
+ 
+   printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser));
+-  assert(sizeof(http_parser) == 4 + 4 + 8 + 2 + 2 + 4 + sizeof(void *));
++  /* x32 tail-pads the struct: 4-byte pointers, 8-byte aligned uint64_t. */
++  assert(sizeof(http_parser) ==
++         (4 + 4 + 8 + 2 + 2 + 4 + sizeof(void *) + __alignof__(http_parser) - 1)
++             / __alignof__(http_parser) * __alignof__(http_parser));
+ 
+   //// API
+   test_preserve_data();
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/http-parser.git/commitdiff/863cf754825291f7cc2a867eb4cbfd51c9816200



More information about the pld-cvs-commit mailing list