1
0
mirror of https://git.freebsd.org/ports.git synced 2026-06-02 11:08:52 +00:00

Mk/bsd.port.mk: Add EXTRACT_ENV

Add an EXTRACT_ENV variable which defaults to LC_ALL=C.UTF-8.  We set
LC_ALL=C globally to ensure our scripts work the way we intend them to,
but this causes tar and unzip to fail to extract distfiles containing
names that cannot be expressed in ASCII.  This was previously masked by
a bug in libarchive which caused tar and unzip to fail to notice that
these names were unconvertible and just pass them through unchanged.

MFH:		2026Q2
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D57295
This commit is contained in:
Dag-Erling Smørgrav
2026-05-28 16:33:27 +02:00
parent 2e2e12e7ac
commit 98103f1943
+4 -1
View File
@@ -680,6 +680,7 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org
#
# For extract:
#
# EXTRACT_ENV - Environment to pass to ${EXTRACT_CMD}
# EXTRACT_CMD - Command for extracting archive
# Default: ${TAR}
# EXTRACT_BEFORE_ARGS
@@ -2143,6 +2144,7 @@ PATCH_DIST_ARGS+= --suffix .orig
TAR?= /usr/bin/tar
# EXTRACT_SUFX is defined in .pre.mk section
EXTRACT_ENV?= LC_ALL=C.UTF-8
EXTRACT_CMD?= ${TAR}
EXTRACT_BEFORE_ARGS?= -xf
EXTRACT_AFTER_ARGS?= --no-same-owner --no-same-permissions
@@ -3209,7 +3211,8 @@ clean-wrkdir:
. if !target(do-extract)
do-extract: ${EXTRACT_WRKDIR}
@for file in ${EXTRACT_ONLY}; do \
if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_ENV} ${EXTRACT_CMD} \
${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
then \
${ECHO_MSG} "===> Failed to extract \"${_DISTDIR}/$$file\"."; \
exit 1; \