[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
New submission from Марк Коренберг socketp...@gmail.com: How to test: #! /usr/bin/python import subprocess, sys # will print err to sys.stderr subprocess.call(['rmdir', '/no_such_dir']) # will NOT print err to sys.stderr subprocess.call(['rmdir', '/no_such_dir'], stdout=sys.stderr) According to strace, in child process: - dup2(2, 1) // that's what I expect, okay close(2) // that's I was not expect, so bug here execve(...) - Bug is in subprocess.py: (search for dup2 in file) I do not known how to fix correctly. Logick in this module is brain damaged in some places. - # Dup fds for child if p2cread is not None: os.dup2(p2cread, 0) if c2pwrite is not None: os.dup2(c2pwrite, 1) if errwrite is not None: os.dup2(errwrite, 2) # Close pipe fds. Make sure we don't close the same # fd more than once, or standard fds. if p2cread is not None and p2cread not in (0,): os.close(p2cread) if c2pwrite is not None and c2pwrite not in (p2cread, 1): os.close(c2pwrite) if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): os.close(errwrite) - -- components: Library (Lib) messages: 137510 nosy: mmarkk priority: normal severity: normal status: open title: subprocess(..., stdout=sys.stderr) closes stderr for child type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
Changes by Alexey Smirnov alexey.smir...@gmx.com: -- nosy: +alexey-smirnov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
Марк Коренберг socketp...@gmail.com added the comment: patch (was not tested) attached -- keywords: +patch Added file: http://bugs.python.org/file7/z.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
Changes by Evgeny Tarasov etarasov@gmail.com: -- nosy: +Evgeny.Tarasov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
Charles-François Natali neolo...@free.fr added the comment: It's a duplicate of issue #10806, fixed in 2.7, 3.1 and 3.2. Closing. -- nosy: +charles-francois.natali resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - Subprocess error if fds 0,1,2 are closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
Марк Коренберг socketp...@gmail.com added the comment: Why not to backport to python 2.6 ? this is the bug, not a feature. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12251] subprocess(..., stdout=sys.stderr) closes stderr for child
R. David Murray rdmur...@bitdance.com added the comment: Because 2.6 is in security-fix-only mode. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12251 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com