From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 finch.gentoo.org (Postfix) with ESMTPS id 920F215807A for ; Sun, 08 Jun 2025 13:36:24 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 79CEB34314F for ; Sun, 08 Jun 2025 13:36:24 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id CFCBC1103DA; Sun, 08 Jun 2025 13:36:19 +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 bobolink.gentoo.org (Postfix) with ESMTPS id C5C591103DA for ; Sun, 08 Jun 2025 13:36:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 smtp.gentoo.org (Postfix) with ESMTPS id 7B1FC342FE0 for ; Sun, 08 Jun 2025 13:36:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 188C22942 for ; Sun, 08 Jun 2025 13:36:18 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1749389772.75d1b66dd525f4f24e99200cf7d8fd902e921b40.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ecompress X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 75d1b66dd525f4f24e99200cf7d8fd902e921b40 X-VCS-Branch: master Date: Sun, 08 Jun 2025 13:36:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 934c923f-1a97-4662-b44d-f6a24048579a X-Archives-Hash: 8f3196bdf9ae702f864d6f0010b79e98 commit: 75d1b66dd525f4f24e99200cf7d8fd902e921b40 Author: Kerin Millar plushkava net> AuthorDate: Sun Jun 8 11:54:37 2025 +0000 Commit: Sam James gentoo org> CommitDate: Sun Jun 8 13:36:12 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=75d1b66d ecompress: don't process pathnames containing In some instances, ecompress produces and consumes streams consisting of null-terminated pathnames. In other instances, ecompress produces and consumes streams consisting of -terminated pathnames. In particular, the temporary files comprise -terminated pathnames. This requirement is further entrenched by the manner in which the do_ignore() function makes use of the sort(1) and comm(1) utilities. In other words, there are two incompatible data models at play. Thus, it is imperative that the the constraints imposed by the lesser model are adhered to. The only way to do that is to refuse to process pathnames that contain the in any capacity. Impose this necessary constraint by introducing the changes described herewith. Have both the do_ignore() and do_queue() functions disregard operands that contain . This concerns the composition of the ".ecompress_skip_files" and ".ecompress_had_precompressed" files, respectively. Have the do_queue() function invoke find(1) in such a way that any pathname containing is disregarded. This concerns the composition of the ".ecompress_had_precompressed" file. In all cases where find(1) is charged with locating files whose names match the "*.ecompress" glob, invoke it in such a way that any pathname containing is disregarded. I would add that, while these changes will almost certainly be invisible in nature - and will remain largely unappreciated - there can be no excuse for dodging the issue. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/ecompress | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/bin/ecompress b/bin/ecompress index d848d18275..a21391d1ed 100755 --- a/bin/ecompress +++ b/bin/ecompress @@ -19,7 +19,11 @@ do_ignore() { : > "${T}/.ecompress_skip_files" || die for skip; do - if [[ -d ${ED%/}/${skip#/} ]]; then + if [[ ${skip} == *$'\n'* ]]; then + # The operand must be disregarded because the temporary + # files comprise -terminated pathnames. + continue + elif [[ -d ${ED%/}/${skip#/} ]]; then skip_dirs+=( "${ED%/}/${skip#/}" ) else rm -f -- "${ED%/}/${skip#/}.ecompress" \ @@ -33,7 +37,7 @@ do_ignore() { skip=${skip%.ecompress} printf '%s\n' "${skip#"${D%/}"}" || ! break done \ - < <(printf '%s\0' "${skip_dirs[@]}" | find0 -name '*.ecompress' -print0 -delete) \ + < <(printf '%s\0' "${skip_dirs[@]}" | find0 -name '*.ecompress' ! -path $'*\n*' -print0 -delete) \ >> "${T}/.ecompress_skip_files" || die # Check whether the invocation of find(1) succeeded. @@ -57,7 +61,11 @@ do_queue() { local -A collisions for path; do - if [[ -e ${ED%/}/${path#/} ]]; then + if [[ ${path} == *$'\n'* ]]; then + # The operand must be disregarded because the temporary + # files comprise -terminated pathnames. + continue + elif [[ -e ${ED%/}/${path#/} ]]; then paths+=( "${ED%/}/${path#/}" ) fi done @@ -67,6 +75,9 @@ do_queue() { if [[ ${PORTAGE_DOCOMPRESS_SIZE_LIMIT} ]]; then find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" ) fi + # Note that the find(1) command that feeds this loop is made to + # ignore pathnames containing . It must do so because + # the temporary files comprise -terminated pathnames. while IFS= read -rd '' path; do # detect the horrible posibility of the ebuild installing # colliding compressed and/or uncompressed variants @@ -92,7 +103,7 @@ do_queue() { : >> "${path}.ecompress" || die done \ - < <(printf '%s\0' "${paths[@]}" | find0 "${find_args[@]}" -print0) \ + < <(printf '%s\0' "${paths[@]}" | find0 "${find_args[@]}" ! -path $'*\n*' -print0) \ > "${T}"/.ecompress_had_precompressed || die # Check whether the invocation of find(1) succeeded. @@ -212,7 +223,7 @@ done # setup compression stuff PORTAGE_COMPRESS=${PORTAGE_COMPRESS-bzip2} if [[ -z ${PORTAGE_COMPRESS} ]]; then - printf '%s\0' "${ED}" | find0 -name '*.ecompress' -delete + printf '%s\0' "${ED}" | find0 -name '*.ecompress' ! -path $'*\n*' -delete exit 0 fi @@ -243,7 +254,7 @@ fi export PORTAGE_COMPRESS_SUFFIX PORTAGE_COMPRESS_FLAGS PORTAGE_COMPRESS printf '%s\0' "${ED}" \ -| find0 -name '*.ecompress' -delete -print0 \ +| find0 -name '*.ecompress' ! -path $'*\n*' -delete -print0 \ | ___parallel_xargs -0 "${PORTAGE_BIN_PATH}"/ecompress-file all_compressed=$(( $? == 0 ))