From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 79E4915815E for ; Fri, 9 Feb 2024 07:08:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 920EDE29CC; Fri, 9 Feb 2024 07:08:31 +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 7AA58E29CC for ; Fri, 9 Feb 2024 07:08:29 +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 4727434313A for ; Fri, 9 Feb 2024 07:08:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A46B314C4 for ; Fri, 9 Feb 2024 07:08:26 +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: <1707462502.a308d831ceb1f1e7d0733700117cc18c8eca09c8.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/tests/process/test_spawn_fail_e2big.py X-VCS-Directories: lib/portage/tests/process/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: a308d831ceb1f1e7d0733700117cc18c8eca09c8 X-VCS-Branch: master Date: Fri, 9 Feb 2024 07:08:26 +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: 63f30727-0258-4d3b-b0b5-fbb0fae92186 X-Archives-Hash: 82c60ca5260db6f74e747947f6709747 commit: a308d831ceb1f1e7d0733700117cc18c8eca09c8 Author: Matoro Mahri matoro tk> AuthorDate: Wed Jan 31 20:26:06 2024 +0000 Commit: Sam James gentoo org> CommitDate: Fri Feb 9 07:08:22 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a308d831 tests: process: calculate size of E2BIG environment variable dynamically The size of the command line required to trigger E2BIG response from the kernel is defined as MAX_ARG_STRLEN, which is equal to 32 * PAGE_SIZE. Therefore the minimum size required to trigger the expected error response must be calculated dynamically based on PAGE_SIZE. Bug: https://bugs.gentoo.org/923368 Signed-off-by: Matoro Mahri matoro.tk> Closes: https://github.com/gentoo/portage/pull/1246 Signed-off-by: Sam James gentoo.org> lib/portage/tests/process/test_spawn_fail_e2big.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/process/test_spawn_fail_e2big.py b/lib/portage/tests/process/test_spawn_fail_e2big.py index 7a00966302..abb1113fea 100644 --- a/lib/portage/tests/process/test_spawn_fail_e2big.py +++ b/lib/portage/tests/process/test_spawn_fail_e2big.py @@ -2,6 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 import platform +import resource import pytest @@ -12,7 +13,9 @@ from portage.const import BASH_BINARY @pytest.mark.skipif(platform.system() != "Linux", reason="not Linux") def test_spawnE2big(capsys, tmp_path): env = dict() - env["VERY_LARGE_ENV_VAR"] = "X" * 1024 * 256 + # Kernel MAX_ARG_STRLEN is defined as 32 * PAGE_SIZE + max_arg_strlen_bytes = 32 * resource.getpagesize() + env["VERY_LARGE_ENV_VAR"] = "X" * max_arg_strlen_bytes logfile = tmp_path / "logfile" echo_output = "Should never appear" @@ -24,7 +27,7 @@ def test_spawnE2big(capsys, tmp_path): with open(logfile) as f: logfile_content = f.read() assert ( - "Largest environment variable: VERY_LARGE_ENV_VAR (262164 bytes)" + f"Largest environment variable: VERY_LARGE_ENV_VAR ({max_arg_strlen_bytes + 20} bytes)" in logfile_content ) assert retval == 1