Opened at 2010-11-07T03:03:15Z
Closed at 2011-01-08T21:36:15Z
#1251 closed defect (fixed)
show-tool-versions always reports stdout and stderr encodings as None; remove these reports
Reported by: | davidsarah | Owned by: | davidsarah |
---|---|---|---|
Priority: | minor | Milestone: | soon (release n/a) |
Component: | dev-infrastructure | Version: | 1.8.0 |
Keywords: | cleanup build-helpers reviewed | Cc: | |
Launchpad Bug: |
Description
The stdio output of the show-tool-versions build step always says:
sys.stdout.encoding: None sys.stderr.encoding: None
Note that stdout.encoding and stderr.encoding are None when they are redirected. misc/build_helpers/show-tool-versions.py tries to work around that, but fails:
- to get stdout.encoding, it spawns a subprocess in which stdout is not explicitly redirected, which prints its stdout.encoding on stderr.
- to get stderr.encoding, it spawns a subprocess in which stderr is not explicitly redirected, which prints its stderr.encoding on stdout.
This doesn't work because the subprocesses inherit the stdin and stdout that was redirected in their parent. The same happens on a command line, e.g.:
> python -c "import sys, os, subprocess; print subprocess.Popen([sys.executable, '-c', 'import sys; print sys.stderr.encoding'], stdin=open(os.devnull), stdout=subprocess.PIPE).communicate()[0]" 2>out.txt None
Attachments (1)
Change History (14)
comment:1 Changed at 2010-12-01T20:01:42Z by davidsarah
- Keywords build-helpers added
Changed at 2011-01-03T02:23:21Z by davidsarah
comment:2 Changed at 2011-01-03T02:24:07Z by davidsarah
- Keywords review-needed added
comment:3 Changed at 2011-01-03T02:26:30Z by davidsarah
- Milestone changed from undecided to soon (release n/a)
comment:4 Changed at 2011-01-04T00:06:06Z by davidsarah
- Keywords cleanup added
- Summary changed from show-tool-versions always reports stdout and stderr encodings as None to show-tool-versions always reports stdout and stderr encodings as None; remove them
comment:5 Changed at 2011-01-04T00:06:41Z by davidsarah
- Summary changed from show-tool-versions always reports stdout and stderr encodings as None; remove them to show-tool-versions always reports stdout and stderr encodings as None; remove these reports
comment:6 Changed at 2011-01-08T17:32:54Z by rockstar
- Owner changed from somebody to rockstar
- Status changed from new to assigned
comment:7 Changed at 2011-01-08T18:43:49Z by rockstar
So, we remove the information entirely in this patch. Was the information ever helpful? If not, I'm quite okay with this patch.
If it was helpful, maybe we could check for None and display "redirected" or check sys.stdout.encoding for None and then not print_stderr/print_stdout (because we've already established that it's not helpful when it prints "None") or perhaps print "Redirected" or something like that.
comment:8 follow-up: ↓ 11 Changed at 2011-01-08T19:32:41Z by zooko
Yes, the information was, as far as I know, never actually produced. Even if I'm wrong and it was, it wasn't important information to us.
comment:9 Changed at 2011-01-08T20:31:36Z by davidsarah
- Keywords reviewed added; review-needed removed
- Owner changed from rockstar to davidsarah
- Status changed from assigned to new
comment:10 Changed at 2011-01-08T20:31:44Z by davidsarah
- Status changed from new to assigned
comment:11 in reply to: ↑ 8 Changed at 2011-01-08T20:50:47Z by davidsarah
Replying to zooko:
Yes, the information was, as far as I know, never actually produced.
Correct. Producing it would require creating an independent terminal on Unix, or using CreateProcess with bInheritHandles == FALSE on Windows, and that wouldn't justify its complexity here.
comment:12 Changed at 2011-01-08T21:35:26Z by david-sarah@…
In 3ad08e6d2f7362cf:
comment:13 Changed at 2011-01-08T21:36:15Z by davidsarah
- Resolution set to fixed
- Status changed from assigned to closed
misc/build_helpers/show-tool-versions.py: remove attempts to show stdout.encoding and stderr.encoding that always printed None due to redirection. Also remove code to show os.path.supports_unicode_filenames which is not useful. refs #1251