Skip to content

bpo-44572: On Windows platform disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption #27092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

Konstantin-Glukhov
Copy link

@Konstantin-Glukhov Konstantin-Glukhov commented Jul 12, 2021

If script.py contains a call to platform.win32* functions the following invocation
inadvertently consumes STDIN redirected from file:

python.exe script.py < file

To address the issue, stdin=subprocess.DEVNULL argument needs to be added to subprocess.check_output() call in platform._syscmd_ver().

https://bugs.python.org/issue44572

…er() to prevent erroneous STDIN consumption
@zooba
Copy link
Member

zooba commented Jul 13, 2021

Thanks for the pull request! The only thing left is to add the NEWS entry, which should be straightforward for you to click on its "Details" link and fill out.

The description will be under the Windows section, so just a line like Avoid consuming standard input in the :mod:`platform` module will be graet.

@zooba zooba merged commit 0ee0a74 into python:main Jul 13, 2021
@zooba zooba added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Jul 13, 2021
@miss-islington
Copy link
Contributor

Thanks @Konstantin-Glukhov for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @Konstantin-Glukhov for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-27124 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jul 13, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 13, 2021
…prevent erroneous STDIN consumption (pythonGH-27092)

(cherry picked from commit 0ee0a74)

Co-authored-by: Konstantin-Glukhov <[email protected]>
@bedevere-bot
Copy link

GH-27125 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jul 13, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 13, 2021
…prevent erroneous STDIN consumption (pythonGH-27092)

(cherry picked from commit 0ee0a74)

Co-authored-by: Konstantin-Glukhov <[email protected]>
pablogsal pushed a commit that referenced this pull request Jul 13, 2021
…prevent erroneous STDIN consumption (GH-27092) (GH-27124)

(cherry picked from commit 0ee0a74)

Co-authored-by: Konstantin-Glukhov <[email protected]>
zooba pushed a commit that referenced this pull request Jul 14, 2021
…prevent erroneous STDIN consumption (GH-27092)

(cherry picked from commit 0ee0a74)

Co-authored-by: Konstantin-Glukhov <[email protected]>
@Konstantin-Glukhov Konstantin-Glukhov deleted the bpo-44572 branch July 14, 2021 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants