commit: 502bd866c85a44852bf1b214c3504d00ca50add5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Jul 16 03:40:36 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 22 22:29:33 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=502bd866
isolated-functions.sh: drop the __assert_sigpipe_ok() function
The __assert_sigpipe_ok() function was introduced in 2010 as a means of
helping to handle the processing of malformed tarballs being distributed
for various sub-projects of GNOME. Among them were the tarballs for
glibmm and evolution-data-server, both of which were found to be the
improper concatenations of two tar archives of the archaic "v7" format.
As things stand now, fifteen years later, I believe it to be a hack that
has run its course. Nowadays, it is conventional for both GNU tar and
bsdtar to produce archives that are of the "pax" format, as defined by
POSIX.1-2001. This is a format unencumbered by the limitations that were
indirectly responsible for the aforesaid defective tarballs. Besides
which, the unpack() function of the "phase-helpers.sh" unit no longer
calls __assert_sigpipe_ok() (since commit 6a3cd41450).
Hence, jettison the __assert_sigpipe_ok() function. Further, jettison
the 'PORTAGE_SIGPIPE_STATUS' environment variable that had hitherto been
defined by the "doebuild.py" unit. The purpose of this variable was to
render the function aware of the numerical value of SIGPIPE. Yet, the
shell requires no assistance in determining this information.
$ read -ra sigs < <(set -o posix; kill -l)
$ for i in "${!sigs[@]}"; do [[ ${sigs[i++]} == PIPE ]] && break; done
$ echo "$i"
13
Link: https://bugs.gentoo.org/309001
Link: https://bugzilla.gnome.org/show_bug.cgi?id=613808#c9
See-also: 6a3cd41450a78422248f10e1272fdd529bd8bc98
See-also: 0ab6f83070c9a32a24454053319c99559c2654ca
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/isolated-functions.sh | 26 ---------------------
bin/phase-functions.sh | 27 +++++++++++-----------
bin/save-ebuild-env.sh | 4 ++--
.../package/ebuild/_config/special_env_vars.py | 1 -
lib/portage/package/ebuild/doebuild.py | 5 ----
5 files changed, 15 insertions(+), 48 deletions(-)
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index c6ce52928c..109c1cd9c6 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -29,32 +29,6 @@ assert() {
done
}
-__assert_sigpipe_ok() {
- # When extracting a tar file like this:
- #
- # bzip2 -dc foo.tar.bz2 | tar xof -
- #
- # For some tar files (see bug #309001), tar will
- # close its stdin pipe when the decompressor still has
- # remaining data to be written to its stdout pipe. This
- # causes the decompressor to be killed by SIGPIPE. In
- # this case, we want to ignore pipe writers killed by
- # SIGPIPE, and trust the exit status of tar. We refer
- # to the bash manual section "3.7.5 Exit Status"
- # which says, "When a command terminates on a fatal
- # signal whose number is N, Bash uses the value 128+N
- # as the exit status."
-
- local x pipestatus=${PIPESTATUS[*]}
- for x in ${pipestatus} ; do
- # Allow SIGPIPE through (128 + 13)
- [[ ${x} -ne 0 && ${x} -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] &&
die "$@"
- done
-
- # Require normal success for the last process (tar).
- [[ ${x} -eq 0 ]] || die "$@"
-}
-
shopt -s extdebug
# __dump_trace([number of funcs on stack to skip],
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 74771edf52..5c9f488a90 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -20,20 +20,19 @@ portage_readonly_vars=(
PORTAGE_EBUILD_EXIT_FILE PORTAGE_ECLASS_LOCATIONS
PORTAGE_EXPLICIT_INHERIT PORTAGE_OVERRIDE_EPREFIX
PORTAGE_BINPKG_TAR_OPTS PORTAGE_INTERNAL_CALLER PORTAGE_ACTUAL_DISTDIR
- PORTAGE_BINPKG_TMPFILE PORTAGE_SIGPIPE_STATUS PORTAGE_XATTR_EXCLUDE
- PORTAGE_REPOSITORIES PORTAGE_WORKDIR_MODE PORTAGE_BINPKG_FILE
- PORTAGE_BUILD_GROUP PORTAGE_DEPCACHEDIR PM_EBUILD_HOOK_DIR
- PORTAGE_BUILD_USER PORTAGE_CONFIGROOT PORTAGE_IPC_DAEMON
- PORTAGE_PROPERTIES PORTAGE_PYTHONPATH PORTAGE_UPDATE_ENV
- PORTAGE_REPO_NAME PORTAGE_ARCHLIST PORTAGE_BIN_PATH PORTAGE_BUILDDIR
- PORTAGE_COLORMAP PORTAGE_INST_GID PORTAGE_INST_UID PORTAGE_LOG_FILE
- PORTAGE_PYM_PATH PORTAGE_RESTRICT PORTAGE_USERNAME PORTAGE_GRPNAME
- PORTAGE_VERBOSE PORTAGE_BASHRC PORTAGE_PYTHON PORTAGE_TMPDIR
- PORTAGE_DEBUG PORTAGE_IUSE PORTAGE_GID REPLACED_BY_VERSION
- REPLACING_VERSIONS T WORKDIR __PORTAGE_TEST_HARDLINK_LOCKS
- __PORTAGE_HELPER portage_mutable_filtered_vars
- portage_saved_readonly_vars portage_readonly_metadata
- portage_readonly_vars
+ PORTAGE_BINPKG_TMPFILE PORTAGE_XATTR_EXCLUDE PORTAGE_REPOSITORIES
+ PORTAGE_WORKDIR_MODE PORTAGE_BINPKG_FILE PORTAGE_BUILD_GROUP
+ PORTAGE_DEPCACHEDIR PM_EBUILD_HOOK_DIR PORTAGE_BUILD_USER
+ PORTAGE_CONFIGROOT PORTAGE_IPC_DAEMON PORTAGE_PROPERTIES
+ PORTAGE_PYTHONPATH PORTAGE_UPDATE_ENV PORTAGE_REPO_NAME
+ PORTAGE_ARCHLIST PORTAGE_BIN_PATH PORTAGE_BUILDDIR PORTAGE_COLORMAP
+ PORTAGE_INST_GID PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_PYM_PATH
+ PORTAGE_RESTRICT PORTAGE_USERNAME PORTAGE_GRPNAME PORTAGE_VERBOSE
+ PORTAGE_BASHRC PORTAGE_PYTHON PORTAGE_TMPDIR PORTAGE_DEBUG PORTAGE_IUSE
+ PORTAGE_GID REPLACED_BY_VERSION REPLACING_VERSIONS T WORKDIR
+ __PORTAGE_TEST_HARDLINK_LOCKS __PORTAGE_HELPER
+ portage_mutable_filtered_vars portage_saved_readonly_vars
+ portage_readonly_metadata portage_readonly_vars
)
portage_saved_readonly_vars=(
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index b71de06ed1..5198f6f9e7 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -84,8 +84,8 @@ __save_ebuild_env() (
REPLY=(
EXPORT_FUNCTIONS KV_to_int KV_major KV_micro KV_minor
- __assert_sigpipe_ok __abort_configure __abort_compile
- __abort_handler __abort_install __abort_prepare __abort_test
+ __abort_configure __abort_compile __abort_handler
+ __abort_install __abort_prepare __abort_test
__check_bash_version __compose_bzip2_cmd __dyn_configure
__dyn_compile __dyn_install __dyn_prepare __dyn_pretend
__dump_trace __dyn_unpack __dyn_clean __dyn_setup __dyn_help
diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py
b/lib/portage/package/ebuild/_config/special_env_vars.py
index cb78ddc347..a8e3c11419 100644
--- a/lib/portage/package/ebuild/_config/special_env_vars.py
+++ b/lib/portage/package/ebuild/_config/special_env_vars.py
@@ -171,7 +171,6 @@ environ_whitelist = frozenset(
"PORTAGE_REPO_NAME",
"PORTAGE_REPOSITORIES",
"PORTAGE_RESTRICT",
- "PORTAGE_SIGPIPE_STATUS",
"PORTAGE_SOCKS5_PROXY",
"PORTAGE_TMPDIR",
"PORTAGE_UPDATE_ENV",
diff --git a/lib/portage/package/ebuild/doebuild.py
b/lib/portage/package/ebuild/doebuild.py
index b495c046af..c0dd591a42 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -472,11 +472,6 @@ def doebuild_environment(
# Set requested Python interpreter for Portage helpers.
mysettings["PORTAGE_PYTHON"] = portage._python_interpreter
- # This is used by assert_sigpipe_ok() that's used by the ebuild
- # unpack() helper. SIGPIPE is typically 13, but its better not
- # to assume that.
- mysettings["PORTAGE_SIGPIPE_STATUS"] = str(128 + signal.SIGPIPE)
-
# We are disabling user-specific bashrc files.
mysettings["BASH_ENV"] = INVALID_ENV_FILE