From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/
Date: Fri, 9 Feb 2024 07:08:26 +0000 (UTC) [thread overview]
Message-ID: <1707462502.a308d831ceb1f1e7d0733700117cc18c8eca09c8.sam@gentoo> (raw)
commit: a308d831ceb1f1e7d0733700117cc18c8eca09c8
Author: Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Wed Jan 31 20:26:06 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> 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_gentoo <AT> matoro.tk>
Closes: https://github.com/gentoo/portage/pull/1246
Signed-off-by: Sam James <sam <AT> 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
next reply other threads:[~2024-02-09 7:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 7:08 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-02-28 6:26 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/ Zac Medico
2024-02-25 0:45 Zac Medico
2024-02-03 22:54 Zac Medico
2023-11-02 14:57 Zac Medico
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2023-05-26 15:45 Sam James
2021-01-18 12:20 Zac Medico
2021-01-18 12:20 Zac Medico
2019-08-31 3:10 Zac Medico
2019-04-14 19:45 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1707462502.a308d831ceb1f1e7d0733700117cc18c8eca09c8.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox