From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C012B158094 for ; Sun, 25 Sep 2022 18:27:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 95F252BC0F2; Sun, 25 Sep 2022 18:23:38 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 46ADF2BC0EF for ; Sun, 25 Sep 2022 18:23:38 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 14/15] unpacker.eclass: Fix handling GNU ar archives in hand-weaved impl Date: Sun, 25 Sep 2022 20:23:16 +0200 Message-Id: <20220925182317.1559529-15-mgorny@gentoo.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220925182317.1559529-1-mgorny@gentoo.org> References: <20220925182317.1559529-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 96b8ecaa-083c-4409-8f77-6b48a9495a89 X-Archives-Hash: 49514badc971e04e7c196cd1c1bba02e Fix the hand-weaved implementation of ar unpacking that is used on Prefix to handle slash-terminated filenames of GNU ar format correctly. Signed-off-by: Michał Górny --- eclass/tests/unpacker.sh | 4 ++++ eclass/unpacker.eclass | 2 ++ 2 files changed, 6 insertions(+) diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh index bbbfa32623ab..e42e656756c4 100755 --- a/eclass/tests/unpacker.sh +++ b/eclass/tests/unpacker.sh @@ -134,6 +134,10 @@ test_deb() { test_unpack "test-${tool}_1.2.3_noarch.deb" test.in "ar tar ${tool}" \ "create_deb '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}" + # also test with the hand-weaved implementation used on Prefix + EPREFIX=/foo \ + test_unpack "test_pfx-${tool}_1.2.3_noarch.deb" test.in "ar tar ${tool}" \ + "create_deb '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}" } create_gpkg() { diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass index 370f00a83bba..100f11428622 100644 --- a/eclass/unpacker.eclass +++ b/eclass/unpacker.eclass @@ -282,6 +282,8 @@ unpack_deb() { local f timestamp uid gid mode size magic while read f timestamp uid gid mode size magic ; do [[ -n ${f} && -n ${size} ]] || continue # ignore empty lines + # GNU ar uses / as filename terminator (and .deb permits that) + f=${f%/} if [[ ${f} = "data.tar"* ]] ; then head -c "${size}" > "${f}" else -- 2.37.3