[PATCH 37/94] app-shells/bash: fix PIPESIZE when cross-compiled to Hurd

Sam James <[email protected]>
Newsgroups gmane.linux.gentoo.devel
Message-ID <66e948d5a7a351a842ced83ad24319eaa14e3b56.1774994319.git.sam@gentoo.org>
We have to hack PIPESIZE because psize.sh doesn't behave correctly
for cross-compilation. It picks a too-small value and so config.status
generation at end of configure will hang natively.

I compiled psize.c manually and ran it on 32-bit Hurd (i686-gnu) to
verify the correct value.

Also, add a comment for another cross workaround we already had.

Bug: https://lists.debian.org/debian-cross/2023/11/msg00000.html
Bug: https://lists.gnu.org/archive/html/bug-bash/2024-11/msg00202.html
Bug: https://lists.nongnu.org/archive/html/bug-bash/2005-04/msg00074.html
Signed-off-by: Sam James <[email protected]>
---
 app-shells/bash/bash-5.3_p9.ebuild               | 16 ++++++++++++++++
 .../bash/bash-5.4_alpha_pre20251202.ebuild       | 16 ++++++++++++++++
 app-shells/bash/bash-9999.ebuild                 | 16 ++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/app-shells/bash/bash-5.3_p9.ebuild b/app-shells/bash/bash-5.3_p9.ebuild
index 0c65da5eec0cd..e36c6f85707fb 100644
--- a/app-shells/bash/bash-5.3_p9.ebuild
+++ b/app-shells/bash/bash-5.3_p9.ebuild
@@ -175,7 +175,23 @@ src_configure() {
 	unset -v YACC
 
 	if tc-is-cross-compiler; then
+		# https://lists.gnu.org/archive/html/bug-bash/2025-05/msg00029.html
 		export CFLAGS_FOR_BUILD="${BUILD_CFLAGS} -std=gnu17"
+
+		if use kernel_Hurd ; then
+			# Necessary for cross-built bash for Hurd, otherwise
+			# config.status generation at end of configure will hang
+			# natively.
+			#
+			# https://lists.debian.org/debian-cross/2023/11/msg00000.html
+			# https://lists.gnu.org/archive/html/bug-bash/2024-11/msg00202.html
+			# https://lists.gnu.org/archive/html/bug-bash/2005-04/msg00074.html
+			cat <<-EOF > builtins/psize.sh || die
+			#!/bin/sh
+			echo "#define PIPESIZE 16384"
+			EOF
+			chmod +x builtins/psize.sh || die
+		fi
 	fi
 
 	myconf=(
diff --git a/app-shells/bash/bash-5.4_alpha_pre20251202.ebuild b/app-shells/bash/bash-5.4_alpha_pre20251202.ebuild
index 6fec1496d1b36..8c08d6cff5307 100644
--- a/app-shells/bash/bash-5.4_alpha_pre20251202.ebuild
+++ b/app-shells/bash/bash-5.4_alpha_pre20251202.ebuild
@@ -178,7 +178,23 @@ src_configure() {
 	unset -v YACC
 
 	if tc-is-cross-compiler; then
+		# https://lists.gnu.org/archive/html/bug-bash/2025-05/msg00029.html
 		export CFLAGS_FOR_BUILD="${BUILD_CFLAGS} -std=gnu17"
+
+		if use kernel_Hurd ; then
+			# Necessary for cross-built bash for Hurd, otherwise
+			# config.status generation at end of configure will hang
+			# natively.
+			#
+			# https://lists.debian.org/debian-cross/2023/11/msg00000.html
+			# https://lists.gnu.org/archive/html/bug-bash/2024-11/msg00202.html
+			# https://lists.gnu.org/archive/html/bug-bash/2005-04/msg00074.html
+			cat <<-EOF > builtins/psize.sh || die
+			#!/bin/sh
+			echo "#define PIPESIZE 16384"
+			EOF
+			chmod +x builtins/psize.sh || die
+		fi
 	fi
 
 	myconf=(
diff --git a/app-shells/bash/bash-9999.ebuild b/app-shells/bash/bash-9999.ebuild
index 58734d9d40cc3..65666522a2a2c 100644
--- a/app-shells/bash/bash-9999.ebuild
+++ b/app-shells/bash/bash-9999.ebuild
@@ -178,7 +178,23 @@ src_configure() {
 	unset -v YACC
 
 	if tc-is-cross-compiler; then
+		# https://lists.gnu.org/archive/html/bug-bash/2025-05/msg00029.html
 		export CFLAGS_FOR_BUILD="${BUILD_CFLAGS} -std=gnu17"
+
+		if use kernel_Hurd ; then
+			# Necessary for cross-built bash for Hurd, otherwise
+			# config.status generation at end of configure will hang
+			# natively.
+			#
+			# https://lists.debian.org/debian-cross/2023/11/msg00000.html
+			# https://lists.gnu.org/archive/html/bug-bash/2024-11/msg00202.html
+			# https://lists.gnu.org/archive/html/bug-bash/2005-04/msg00074.html
+			cat <<-EOF > builtins/psize.sh || die
+			#!/bin/sh
+			echo "#define PIPESIZE 16384"
+			EOF
+			chmod +x builtins/psize.sh || die
+		fi
 	fi
 
 	myconf=(
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.