From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1660899-garchives=archives.gentoo.org@lists.gentoo.org> 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 28DAD159C9B for <garchives@archives.gentoo.org>; Sun, 11 Aug 2024 10:11:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4FA042BC0EA; Sun, 11 Aug 2024 10:11:15 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.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 pigeon.gentoo.org (Postfix) with ESMTPS id 390202BC0EA for <gentoo-commits@lists.gentoo.org>; Sun, 11 Aug 2024 10:11:15 +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 7DC07340806 for <gentoo-commits@lists.gentoo.org>; Sun, 11 Aug 2024 10:11:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AF79A1EEC for <gentoo-commits@lists.gentoo.org>; Sun, 11 Aug 2024 10:11:10 +0000 (UTC) From: "Sam James" <sam@gentoo.org> 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" <sam@gentoo.org> Message-ID: <1723371061.52d8b440df4e68c9c3dfdea7f3142b1641f2b08e.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh test-functions X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 52d8b440df4e68c9c3dfdea7f3142b1641f2b08e X-VCS-Branch: master Date: Sun, 11 Aug 2024 10:11:10 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 542bc89c-4554-4471-8fc4-5c4cd2ab7246 X-Archives-Hash: 0eb94edf4a40f56df58ebafdeeac33f7 commit: 52d8b440df4e68c9c3dfdea7f3142b1641f2b08e Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Fri Aug 9 07:22:10 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Aug 11 10:11:01 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=52d8b440 Render _update_time() a no-op for the yash shell When integer overflow occurs in a non-interactive yash shell, it prints "yash: arithmetic: overflow" as a diagnostic message before proceeding to exit. That makes it extremely difficult for the arithmetic in the _should_throttle() function to be implemented safely for it. For now, ensure that _update_time() does nothing for yash but return a non-zero status code. In turn, this disables the rate limiting feature for yash. Additionally, refrain from running test_update_time() and test_should_throttle() for yash in test-functions. The former would only amount to a waste of time and the latter would be guaranteed to fail. For the record, my testing was performed with yash 2.56.1. Signed-off-by: Kerin Millar <kfm <AT> plushkava.net> Signed-off-by: Sam James <sam <AT> gentoo.org> functions.sh | 3 ++- test-functions | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index e7ef6fe..641deb6 100644 --- a/functions.sh +++ b/functions.sh @@ -846,7 +846,8 @@ _update_time() fi genfun_time=$(( s * 100 + cs )) } - elif [ -f /proc/uptime ]; then + elif [ -f /proc/uptime ] && [ ! "${YASH_VERSION}" ]; then + # Yash is blacklisted because it dies upon integer overflow. _update_time() { local cs s diff --git a/test-functions b/test-functions index 34ffc41..c96ac48 100755 --- a/test-functions +++ b/test-functions @@ -1024,6 +1024,12 @@ test_deref() { test_update_time() { local locale + # The yash shell dies upon integer overflow and _update_time() ends up + # being deactivated for it. Hence, there is no reason to run this test. + if [ "${YASH_VERSION}" ]; then + return + fi + set -- \ de_BE de_DE es_ES fr_BE fr_CA fr_FR it_IT nl_BE nl_NL pl_PL \ pt_BR pt_PT ru_RU sv_SE @@ -1072,6 +1078,12 @@ test_update_time() { test_should_throttle() { local bits max_int + # The yash shell dies upon integer overflow and _update_time() ends up + # being deactivated for it. Hence, there is no reason to run this test. + if [ "${YASH_VERSION}" ]; then + return + fi + genfun_time= bits=30 while [ "${bits}" -lt 128 ]; do