Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
Fail early when extracting distfiles
To:
ports@openbsd.org
Cc:
landry@openbsd.org, kirill@openbsd.org
Date:
Wed, 30 Jul 2025 10:54:10 +0200

Download raw body.

Thread
Most entries in EXTRACT_CASES look like ${decompressor} | tar -xf -.
When the decompressor fails, for example because of a lack of memory,
the error is currently ignored.  This results in an impartially extracted
distfile, and weird patch / build errors in a later step.

The trick is to catch those pipe errors with the not-so-new pipefail
option.  I've used this in in an almost complete bulk build on amd64
and arm64.

ok?


Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
diff -u -p -r1.1644 bsd.port.mk
--- bsd.port.mk	2 Mar 2025 13:16:48 -0000	1.1644
+++ bsd.port.mk	21 Jul 2025 10:13:55 -0000
@@ -2828,7 +2828,7 @@ _post-extract-finalize:
 .if !target(do-extract)
 do-extract:
 # What EXTRACT normally does:
-	@PATH=${PORTPATH}; set -e; cd ${WRKDIR}; \
+	@PATH=${PORTPATH}; set -e; set -o pipefail; cd ${WRKDIR}; \
 	for archive in ${EXTRACT_ONLY}; do \
 		case $$archive in \
 		${EXTRACT_CASES} \

-- 
jca