From 479f0daedc332ad2be8973f3ecd176cb78beb9f4 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@gentoo.org>
Date: Mon, 15 Sep 2025 11:38:52 -0400
Subject: [PATCH] ensure GNU tar is used in most places

Portage makes certain assumptions in various places, such as --xattrs
enabling FEATURES=xattr and its lack *unconditionally* disabling it. Or,
--wildcard existing.

PMS mandates "GNU Tar" be used to extract files in `unpack`, and a
recent fix went "all in" and used GNU Tar options to improve the
function.

All this is quite reasonable, but nowhere have we ever enforced that
"gtar" is used. libarchive is a valid app-alternatives/tar, on Gentoo,
has been broken subtly in the past, and now breaks src_unpack.

emerge-webrsync alone has "is_gnu" support code introduced since commit
23ce89c761c080e7d3163165dded94241a9a9eea, so leave it alone.

Fixes: 3e89139fae34c9bd2e2b4c0490512f71d1d78546
Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
---

diffstat limited to 3.0.69.1 regression fix only

 bin/phase-helpers.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 02b1aea4e..47c6f8167 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -480,17 +480,17 @@ unpack() {
 				unrar x -idq -o+ "${srcdir}${f}"
 				;;
 			tar.bz|tar.bz2|tbz|tbz2)
-				tar -I "${bzip2_cmd-bzip2} -c" -xof "${srcdir}${f}"
+				gtar -I "${bzip2_cmd-bzip2} -c" -xof "${srcdir}${f}"
 				;;
 			tar|tar.*|tgz)
 				# GNU tar recognises various file suffixes, for
 				# which it is able to execute the appropriate
 				# decompressor. They are documented by the
 				# (info) manual for the -a option.
-				tar --warning=decompress-program -xof "${srcdir}${f}"
+				gtar --warning=decompress-program -xof "${srcdir}${f}"
 				;;
 			txz)
-				tar -xJof "${srcdir}${f}"
+				gtar -xJof "${srcdir}${f}"
 				;;
 			xz)
 				xz -dc -- "${srcdir}${f}" > "${basename%.*}"
-- 
2.49.1

