]> Gentwo Git Trees - linux/.git/commit
kconfig: Fix BrokenPipeError warnings in selftests
authorKees Cook <kees@kernel.org>
Tue, 23 Sep 2025 21:34:17 +0000 (14:34 -0700)
committerKees Cook <kees@kernel.org>
Wed, 24 Sep 2025 21:23:35 +0000 (14:23 -0700)
commit64f4ea200eca05a248533b8374d7b5f0756a3990
tree8c36b18dd632a77d697b2b3ae2b243bf33b8bbfc
parenta40282dd3c484e6c882e93f4680e0a3ef3814453
kconfig: Fix BrokenPipeError warnings in selftests

The kconfig test harness ("make testconfig") was generating BrokenPipeError
warnings when running interactive tests like oldaskconfig and oldconfig:

  /usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <_io.BufferedWriter name=12>

  Traceback (most recent call last):
    File "/srv/code/scripts/kconfig/tests/conftest.py", line 127, in oldaskconfig
      return self._run_conf('--oldaskconfig', dot_config=dot_config,
             ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                            interactive=True, in_keys=in_keys)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  BrokenPipeError: [Errno 32] Broken pipe

The issue occurred when the test framework attempted to write to stdin
after the conf subprocess had already exited.

Wrap stdin write operations in try/except to catch BrokenPipeError and
stop sending more input. Add explicit flush() after writes so we can see
delivery errors immediately. Ignore BrokenPipeError when closing stdin.
Explicitly call wait() to validate subprocess termination.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250923213422.1105654-1-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
scripts/kconfig/tests/conftest.py