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 149E9158128 for ; Tue, 17 Jun 2025 03:00:52 +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) server-digest SHA256) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id ED6C8342693 for ; Tue, 17 Jun 2025 03:00:51 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id E532B1104D9; Tue, 17 Jun 2025 03:00:50 +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) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id D74C41104D9 for ; Tue, 17 Jun 2025 03:00:50 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 822E3340F99 for ; Tue, 17 Jun 2025 03:00:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E89D229DE for ; Tue, 17 Jun 2025 03:00:48 +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: <1750129237.7d91c82fa25bcf641ed96d3a0a6b4a99a9b0aa15.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: 7d91c82fa25bcf641ed96d3a0a6b4a99a9b0aa15 X-VCS-Branch: master Date: Tue, 17 Jun 2025 03:00:48 +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: 22cd6a0b-cd90-4b41-8fba-6e0cdaab5ecd X-Archives-Hash: e4563decab533da203236ed6278447d1 commit: 7d91c82fa25bcf641ed96d3a0a6b4a99a9b0aa15 Author: Kerin Millar plushkava net> AuthorDate: Sun Jun 15 18:09:58 2025 +0000 Commit: Sam James gentoo org> CommitDate: Tue Jun 17 03:00:37 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7d91c82f emerge-webrsync: perform minor refactoring upon check_file_signature() This commit performs some minor refactoring upon the check_file_signature() function, the exact nature of which is described herewith. Drop the 'if' command that is responsible for testing the value of the 'WEBRSYNC_VERIFY_SIGNATURE' variable and potentially displaying an informational message. This responsibility is now handled by the previously enclosed case statement by matching against an additional pattern and deliberately falling through to the next. The maximal degree of identation is thus reduced. Refrain from assigning 1 to the 'r' variable as a foregone conclusion, and drop the superfluous 'return' command. Should verification fail, the die() function is called. Otherwise, the function shall always implicitly return 0. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index fba23610d8..71f01f8708 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -334,38 +334,32 @@ gpg_verify() { check_file_signature() { local signature=$1 file=$2 - local r=1 + local r - if [[ ${WEBRSYNC_VERIFY_SIGNATURE} != 0 ]]; then - [[ ${PORTAGE_QUIET} -eq 1 ]] || einfo "Checking signature ..." - - case ${WEBRSYNC_VERIFY_SIGNATURE} in - 1) - check_file_signature_gemato "${signature}" "${file}" - r=$? - - if [[ ${r} -eq 127 ]] ; then - ewarn "Falling back to gpg as gemato is not installed" - check_file_signature_gpg_unwrapped "${signature}" "${file}" - r=$? - fi - - ;; - 2) + case ${WEBRSYNC_VERIFY_SIGNATURE} in + [12]) + if [[ ${PORTAGE_QUIET} -ne 1 ]]; then + einfo "Checking signature ..." + fi + ;;& + 1) + check_file_signature_gemato "${signature}" "${file}" + r=$? + if [[ ${r} -eq 127 ]] ; then + ewarn "Falling back to gpg as gemato is not installed" check_file_signature_gpg_unwrapped "${signature}" "${file}" r=$? - ;; - esac + fi + ;; + 2) + check_file_signature_gpg_unwrapped "${signature}" "${file}" + r=$? + esac - if [[ ${r} != 0 ]] ; then - eerror "Error occurred in check_file_signature: ${r}. Aborting." - die "Verification error occured." - fi - else - r=0 + if [[ ${r} != 0 ]] ; then + eerror "Error occurred in check_file_signature: ${r}. Aborting." + die "Verification error occured." fi - - return "${r}" } get_snapshot_timestamp() {