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 5CD38158128 for ; Wed, 18 Jun 2025 09:52:07 +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) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 4515D341EAE for ; Wed, 18 Jun 2025 09:52:07 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 4BA511104DC; Wed, 18 Jun 2025 09:52:04 +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) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 41EF11104DC for ; Wed, 18 Jun 2025 09:52:04 +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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EDB84341CC2 for ; Wed, 18 Jun 2025 09:52:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8E25529F5 for ; Wed, 18 Jun 2025 09:52:02 +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: <1750240317.14ffc6330d435002d8c67206ed78e0c31b224fee.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/emerge-webrsync X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 14ffc6330d435002d8c67206ed78e0c31b224fee X-VCS-Branch: master Date: Wed, 18 Jun 2025 09:52:02 +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: cb15a03e-d70a-4201-adfc-89af22ca5dfe X-Archives-Hash: 65948f3a0c4e6fb51be6654d7be9345f commit: 14ffc6330d435002d8c67206ed78e0c31b224fee Author: Kerin Millar plushkava net> AuthorDate: Wed Jun 18 02:59:57 2025 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jun 18 09:51:57 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=14ffc633 emerge-webrsync: routinely employ an explicit arithmetic context Employ the (( … )) command wherever it makes sense to do so. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 459427a152..64bc92fb2c 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -360,7 +360,7 @@ check_file_signature() { ;;& 1) check_file_signature_gemato "${signature}" "${file}" - if [[ ${r=$?} -eq 127 ]] ; then + if (( ${r=$?} == 127 )); then ewarn "Falling back to gpg as gemato is not installed" check_file_signature_gpg_unwrapped "${signature}" "${file}" r=$? @@ -370,7 +370,7 @@ check_file_signature() { check_file_signature_gpg_unwrapped "${signature}" "${file}" esac - if [[ ${r=$?} != 0 ]] ; then + if (( ${r=$?} != 0 )); then eerror "Error occurred in check_file_signature: ${r}. Aborting." die "Verification error occured." fi @@ -506,7 +506,7 @@ do_snapshot() { snapshot_timestamp=$(get_snapshot_timestamp "${DISTDIR}/${file}") if [[ ${ignore_timestamp} == 0 ]]; then - if [[ ${snapshot_timestamp} -lt $(get_repository_timestamp) ]]; then + if (( snapshot_timestamp < $(get_repository_timestamp) )); then ewarn "Repository (age) is newer than fetched snapshot" have_files=0 fi @@ -514,9 +514,9 @@ do_snapshot() { unixtime=$(get_unixtime_by_date "${date}") # Check that this snapshot is what the age it claims to be - if [[ ${snapshot_timestamp} -lt ${unixtime} || \ - ${snapshot_timestamp} -gt $(( unixtime + 2 * 86400 )) ]]; then - + if (( snapshot_timestamp < unixtime + || snapshot_timestamp > unixtime + 2 * 86400 )) + then ewarn "Snapshot timestamp is not within acceptable period!" have_files=0 fi @@ -563,7 +563,7 @@ do_latest_snapshot() { # Daily snapshots are created at 00:45 and are not # available until after 01:00. Don't waste time trying # to fetch a snapshot before it's been created. - if [[ ${start_hour#0} -lt 1 ]] ; then + if (( ${start_hour#0} < 1 )); then (( start_time -= 86400 )) fi @@ -576,15 +576,17 @@ do_latest_snapshot() { (( approx_snapshot_time = snapshot_unixtime + 86400 + 2700 )) (( timestamp_difference = existing_timestamp - approx_snapshot_time )) - [[ ${timestamp_difference} -lt 0 ]] && (( timestamp_difference = -1 * timestamp_difference )) + if (( timestamp_difference < 0 )); then + (( timestamp_difference = -1 * timestamp_difference )) + fi printf -v snapshot_date '%(%Y%m%d)T' "${snapshot_unixtime}" timestamp_problem="" - if [[ ${timestamp_difference} -eq 0 ]]; then + if (( timestamp_difference == 0 )); then timestamp_problem="is identical to" - elif [[ ${timestamp_difference} -lt ${min_time_diff} ]]; then + elif (( timestamp_difference < min_time_diff )); then timestamp_problem="is possibly identical to" - elif [[ ${approx_snapshot_time} -lt ${existing_timestamp} ]] ; then + elif (( approx_snapshot_time < existing_timestamp )); then timestamp_problem="is newer than" fi