Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 923368
Collapse All | Expand All

(-)a/lib/portage/gpkg.py (-2 / +2 lines)
Lines 347-355 class tar_stream_reader: Link Here
347
        kill external program if any error happened in python
347
        kill external program if any error happened in python
348
        """
348
        """
349
        if self.proc is not None:
349
        if self.proc is not None:
350
            self.killed = True
351
            self.proc.kill()
352
            self.proc.stdin.close()
350
            self.proc.stdin.close()
351
            self.proc.kill()
352
            self.killed = True
353
            self.close()
353
            self.close()
354
354
355
    def read(self, bufsize=-1):
355
    def read(self, bufsize=-1):
(-)a/lib/portage/tests/process/test_spawn_fail_e2big.py (-2 / +5 lines)
Lines 2-7 Link Here
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
import platform
4
import platform
5
import resource
5
6
6
import pytest
7
import pytest
7
8
Lines 12-18 from portage.const import BASH_BINARY Link Here
12
@pytest.mark.skipif(platform.system() != "Linux", reason="not Linux")
13
@pytest.mark.skipif(platform.system() != "Linux", reason="not Linux")
13
def test_spawnE2big(capsys, tmp_path):
14
def test_spawnE2big(capsys, tmp_path):
14
    env = dict()
15
    env = dict()
15
    env["VERY_LARGE_ENV_VAR"] = "X" * 1024 * 256
16
    # Kernel MAX_ARG_STRLEN is defined as 32 * PAGE_SIZE
17
    max_arg_strlen_bytes = 1024 * 32 * resource.getpagesize()
18
    env["VERY_LARGE_ENV_VAR"] = "X" * max_arg_strlen_bytes
16
19
17
    logfile = tmp_path / "logfile"
20
    logfile = tmp_path / "logfile"
18
    echo_output = "Should never appear"
21
    echo_output = "Should never appear"
Lines 24-30 def test_spawnE2big(capsys, tmp_path): Link Here
24
    with open(logfile) as f:
27
    with open(logfile) as f:
25
        logfile_content = f.read()
28
        logfile_content = f.read()
26
        assert (
29
        assert (
27
            "Largest environment variable: VERY_LARGE_ENV_VAR (262164 bytes)"
30
            f"Largest environment variable: VERY_LARGE_ENV_VAR ({max_arg_strlen_bytes + 20} bytes)"
28
            in logfile_content
31
            in logfile_content
29
        )
32
        )
30
    assert retval == 1
33
    assert retval == 1

Return to bug 923368