Opened 10 years ago
Closed 8 years ago
#136 closed defect (wontfix)
python 2.7.6 loses pipe output.
Reported by: | Steven Levine | Owned by: | dmik |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | python | Version: | |
Severity: | highest | Keywords: | |
Cc: | steve53@… |
Description
cvs2svn v2.40 is a python app that can convert cvs repos to a number of formats.
While attempting to use cvs2svn to convert a cvs repo to git, I discovered our python port does not handle pipe output properly.
The visible symptom is that the git repo is structured correctly, but all the files are empty because the piped output of the cvs commands is lost.
cvs2svn is avaiable at
http://cvs2svn.tigris.org/files/documents/1462/49237/cvs2svn-2.4.0.tar.gz
A simple testcase (testcase.py) is attached to this ticket. The testcase requires a cvs2svn installation, but uses on one cvs2svn function which could be moved into the testcase.
The expected output is the data variable contains the command output. The current behavior is that the data variable remains empty.
Attachments (1)
Change History (7)
by , 10 years ago
Attachment: | testcase.py added |
---|
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
interesting... python/2 should be using standard popen() calls which work elsewhere...
comment:4 by , 8 years ago
this is most probably not a python error. it smells like a missing flush() or such.
comment:5 by , 8 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:6 by , 8 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
I checked this. It's not about flush, it's about the fact that non-kLIBC-based programs (like psfiles
or cvs
used in testcase.py
above) know nothing about sockets which are used in python (and virtually in all other Unix tools ported to OS/2 using kLIBC) to capture redirected output. So this output simply goes nowhere and never appears on the caller's end of socketpair. If you use something kLIBC-based in your test (like ls
), the output will be grabbed correctly, just try it.
I created a LIBCx ticket to track this. See https://github.com/bitwiseworks/libcx/issues/34 for more info.
Anyway, this has not much to do with python except that we should replace socketpair
usage back with pipe
when kLIBC select()
is fixed (see the above issue).
Steven, in your case the only workaround for now is to rebuild CVS against kLIBC. Then it will work too. Or write a CVS wrapper built with kLIBC that will grab the output of CVS.EXE using an OS/2 pipe and then write it to its own stdout stream which can be attached to a socket so redirection will work properly in python.
testcase demonstrating pipe data lose