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 5659615807A for ; Sat, 07 Jun 2025 22:54:58 +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 40DEC34313D for ; Sat, 07 Jun 2025 22:54:58 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 71ABC110480; Sat, 07 Jun 2025 22:54:48 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 696A5110480 for ; Sat, 07 Jun 2025 22:54:48 +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 1A86B3430C6 for ; Sat, 07 Jun 2025 22:54:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 45F992916 for ; Sat, 07 Jun 2025 22:54:45 +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: <1749336848.4370f6178e4374ac5031ca16aa545f46e2156850.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: 4370f6178e4374ac5031ca16aa545f46e2156850 X-VCS-Branch: master Date: Sat, 07 Jun 2025 22:54:45 +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: ff1768e5-ceb7-44f0-8122-70986771f422 X-Archives-Hash: 6134b3c32cf1137e70249f4bdde99e81 commit: 4370f6178e4374ac5031ca16aa545f46e2156850 Author: Kerin Millar plushkava net> AuthorDate: Wed Aug 10 23:35:31 2022 +0000 Commit: Sam James gentoo org> CommitDate: Sat Jun 7 22:54:08 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4370f617 ecompress: routinely employ an explict arithmetic context Idiomatically employ the (( … )) command. Also, evaluate the 'something_changed' variable in the arithmetic context. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/ecompress | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/bin/ecompress b/bin/ecompress index 1f7bc7be1c..aa237f7d67 100755 --- a/bin/ecompress +++ b/bin/ecompress @@ -18,7 +18,7 @@ do_ignore() { fi done - if [[ ${#skip_dirs[@]} -gt 0 ]]; then + if (( ${#skip_dirs[@]} )); then while read -r -d '' skip; do skip=${skip%.ecompress} printf -- '%s\n' "${skip#${D%/}}" >> "${T}/.ecompress_skip_files" || die @@ -46,7 +46,7 @@ do_queue() { fi done - if [[ ${#find_args[@]} -gt 0 ]]; then + if (( ${#find_args[@]} )); then find_args+=( -type f ) [[ -n ${PORTAGE_DOCOMPRESS_SIZE_LIMIT} ]] && find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" ) @@ -77,7 +77,7 @@ do_queue() { >> "${path}.ecompress" || die done < <(find "${find_args[@]}" -print0 || die) - if [[ ${#collisions[@]} -gt 0 ]]; then + if (( ${#collisions[@]} )); then eqawarn "QA Notice: Colliding files found by ecompress:" eqawarn for x in "${!collisions[@]}"; do @@ -121,7 +121,7 @@ fix_symlinks() { # Repeat until nothing changes, in order to handle multiple # levels of indirection (see bug #470916). while true ; do - something_changed= + something_changed=0 while read -r -d $'\0' brokenlink ; do [[ -e ${brokenlink} ]] && continue @@ -133,16 +133,15 @@ fix_symlinks() { [[ -f "${brokenlink%/*}/${newdest}" ]] || continue fi - something_changed=${brokenlink} + something_changed=1 rm -f "${brokenlink}" && ln -snf "${newdest}" "${brokenlink}${PORTAGE_COMPRESS_SUFFIX}" ((ret|=$?)) done < <(find "${ED}" -type l -print0 || die) - [[ -n ${something_changed} ]] || break - (( indirection++ )) - - if (( indirection >= 100 )) ; then + if (( ! something_changed )); then + break + elif (( ++indirection >= 100 )); then # Protect against possibility of a bug triggering an endless loop. eerror "ecompress: too many levels of indirection for" \ "'${something_changed#${ED%/}}'" @@ -162,7 +161,7 @@ if ! ___eapi_has_prefix_variables; then ED=${D} EPREFIX= fi -while [[ $# -gt 0 ]] ; do +while (( $# )); do case $1 in --ignore) shift @@ -222,7 +221,7 @@ if [[ -s ${T}/.ecompress_had_precompressed ]]; then n=0 while read -r f; do eqawarn " ${f}" - if [[ $(( n++ )) -eq 10 ]]; then + if (( ++n == 10 )); then eqawarn " ..." break fi