commit:     5440524943be3eef14c2912ae789fa2b61e75380
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 14 16:13:14 2023 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Tue Feb 14 16:13:38 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54405249

net-proxy/haproxy: Fix 2.4.22 re https://github.com/haproxy/haproxy/issues/2009

Signed-off-by: Christian Ruppert <idl0r <AT> gentoo.org>

 net-proxy/haproxy/Manifest                         |  2 +-
 net-proxy/haproxy/files/haproxy-2.4.22-hpack.patch | 49 ++++++++++++++++++++++
 net-proxy/haproxy/haproxy-2.4.22.ebuild            |  1 +
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/net-proxy/haproxy/Manifest b/net-proxy/haproxy/Manifest
index 334f154ec05d..67be8c677f82 100644
--- a/net-proxy/haproxy/Manifest
+++ b/net-proxy/haproxy/Manifest
@@ -1,6 +1,6 @@
 DIST haproxy-2.2.25.tar.gz 2957420 BLAKE2B 
58f85c063bada9c943415ff8a8e51232dec0f4c5b09d43c6a5437ff83bd2cb753bb81f67ad2c4b808cd1995ea6d4b2b2b70017a3f940007637fa398c5bb6884c
 SHA512 
652a0d2eef0706ec506a949c560d7b99d111a75519daaa9a31ab53d99d7fdfc584c52d8401f257bb8f8ac58fc51f1403467749438fde684f064d616a2b4485a2
 DIST haproxy-2.2.29.tar.gz 2969963 BLAKE2B 
c921c5d06ec5d6c19e1b0d62bca27cfc80df76ec2f25e1c96c4703dc8e55baf2cd112d0ae0ccec298809fe7e4258a5f682768849757b8754b73f83e0b1a4a4fe
 SHA512 
066affb96d46de9c323e53cb3766f5eafa4f34f2403107d5d056588462c59b8340fb0e33acebd560e016d695b4423f61b9c42ea2b08d1754448e9919a4c6865f
 DIST haproxy-2.4.18.tar.gz 3626923 BLAKE2B 
1ec312a5607634f7906cfcf5d4e22d829bdca9ee436d2364ff30552375b3acaf748a79dd8a67e215007786aa57ae305e9270d62a07397bfc34f72799e4870220
 SHA512 
4362ebf5eef6560adf558a4db596c2a0349dca05ee51e69c60f5e995d364e4f68d3422391fc5286dd8e2e65ce41a459dbbcba01e6f7b5918870b214683922488
-DIST haproxy-2.4.22.tar.gz 1507328 BLAKE2B 
4eec8b2f5a323390306eaea05807120859141817feb982b50758e2ecdf23b36f0992bd23d30eb2d86c1460609e84f6ec352f576d2d4261c498fd1b312c8368ec
 SHA512 
27220adc865b372935c05dddeb54a39b453c18ec63b953cf7d03a529a9fc895fce9ce0b6dc3b5bbe4b27b57b3e8a0f22e80c564e4c737359085e9b12e30bc82c
+DIST haproxy-2.4.22.tar.gz 3648716 BLAKE2B 
b030faa8fb5e906494a8faeda8ee6a4496ed78dbaabb391a8b7020e5ef66803c4cf14438516435af84237352cca982a724857b61d033a1aa4dfa0ea5248f5b77
 SHA512 
c22ad38046e3c70beb3bf57a62e4e74db329559059e2f36d2f801768c26b1f1222631702e83e9839fab4396c1b78089a807750ff743b4192da06c751cf9f0779
 DIST haproxy-2.6.9.tar.gz 4045208 BLAKE2B 
2222e2265b57a252c596c066b2fed0de89669ac6b86e0c76b31ef2b73e2d8d090a51c46d34553aec6d70a2b61717df0d2ac2eb1053cae0364e3e84334ba35f77
 SHA512 
24d000a38d30502f09c3cd44425bf515382c0a7b1bc5a117a078a198f9c05d618a25148ddee0463458884fc566085d9847e5f89e3c7bda1758ccf5fddef7ebf5
 DIST haproxy-2.7.3.tar.gz 4141275 BLAKE2B 
a72c3ee578c2a1fb1648779c4a7c692d136455f24c2e2afc2e3ce1dba651043b2e897a938bf1da9a790cb6f8c731c331301d085a953674f341fbedc1d8c0847a
 SHA512 
f9eeee2d232fd2f4da1959e9265dd6abe6c6182109a0455d4f868a516e78cc6ea67e8456d5bc26e439385d17f52e4b179d7c615bacf15aeae901ab8e172dc758

diff --git a/net-proxy/haproxy/files/haproxy-2.4.22-hpack.patch 
b/net-proxy/haproxy/files/haproxy-2.4.22-hpack.patch
new file mode 100644
index 000000000000..f744eccfaba9
--- /dev/null
+++ b/net-proxy/haproxy/files/haproxy-2.4.22-hpack.patch
@@ -0,0 +1,49 @@
+From 494ae0c35c883632faf1d22b54083d3e97a7c129 Mon Sep 17 00:00:00 2001
+From: Aurelien DARRAGON <[email protected]>
+Date: Wed, 25 Jan 2023 16:35:00 +0100
+Subject: [PATCH] DEV: hpack: fix `trash` build regression
+
+Since 7d84439 ("BUILD: hpack: include global.h for the trash that is needed
+in debug mode"), hpack decode tool fails to compile on targets that enable
+USE_THREAD. (ie: linux-glibc target as reported by Christian Ruppert)
+
+When building hpack devtool, we are including src/hpack-dec.c as a dependency.
+src/hpack-dec.c relies on the global trash whe debug mode is enabled.
+But as we're building hpack tool with a limited scope of haproxy
+sources, global trash (which is declared in src/chunk.c) is not available.
+Thus, src/hpack-dec.c relies on a local 'trash' variable declared within
+dev/hpack/decode.c
+
+This used to work fine until 7d84439.
+But now that global.h is explicitely included in src/hpack-dec.c,
+trash variable definition from decode.c conflicts with the one from global.h:
+
+  In file included from include/../src/hpack-dec.c:35,
+                   from dev/hpack/decode.c:87:
+  include/haproxy/global.h:52:35: error: thread-local declaration of 'trash' 
follows non-thread-local declaration
+     52 | extern THREAD_LOCAL struct buffer trash;
+
+Adding THREAD_LOCAL attribute to 'decode.c' local trash variable definition
+makes the compiler happy again.
+
+This should fix GH issue #2009
+---
+ dev/hpack/decode.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dev/hpack/decode.c b/dev/hpack/decode.c
+index ae825120f..13c95c77a 100644
+--- a/dev/hpack/decode.c
++++ b/dev/hpack/decode.c
+@@ -30,7 +30,7 @@ uint8_t buf[MAX_RQ_SIZE];
+ char trash_buf[MAX_RQ_SIZE];
+ char tmp_buf[MAX_RQ_SIZE];
+ 
+-struct buffer trash = { .area = trash_buf, .data = 0, .size = 
sizeof(trash_buf) };
++THREAD_LOCAL struct buffer trash = { .area = trash_buf, .data = 0, .size = 
sizeof(trash_buf) };
+ struct buffer tmp   = { .area = tmp_buf,   .data = 0, .size = sizeof(tmp_buf) 
  };
+ 
+ /* displays a <len> long memory block at <buf>, assuming first byte of <buf>
+-- 
+2.34.1
+

diff --git a/net-proxy/haproxy/haproxy-2.4.22.ebuild 
b/net-proxy/haproxy/haproxy-2.4.22.ebuild
index 41eaaee5bb19..1dc2f69b3bad 100644
--- a/net-proxy/haproxy/haproxy-2.4.22.ebuild
+++ b/net-proxy/haproxy/haproxy-2.4.22.ebuild
@@ -52,6 +52,7 @@ S="${WORKDIR}/${MY_P}"
 
 DOCS=( CHANGELOG CONTRIBUTING MAINTAINERS README )
 EXTRAS=( admin/halog admin/iprange dev/tcploop dev/hpack )
+PATCHES=( "${FILESDIR}/${P}-hpack.patch" )
 
 haproxy_use() {
        (( $# != 2 )) && die "${FUNCNAME} <USE flag> <make option>"

Reply via email to