Opened 5 years ago

Closed 3 years ago

#136 closed defect (wontfix)

python 2.7.6 loses pipe output.

Reported by: stevenhl 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)

testcase.py (754 bytes) - added by stevenhl 5 years ago.
testcase demonstrating pipe data lose

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by stevenhl

testcase demonstrating pipe data lose

comment:1 Changed 5 years ago by stevenhl

  • Cc steve53@… added

comment:2 Changed 5 years ago by psmedley

interesting... python/2 should be using standard popen() calls which work elsewhere...

comment:3 Changed 3 years ago by diver

  • Severity set to highest

add #191 as crossreference

comment:4 Changed 3 years ago by diver

this is most probably not a python error. it smells like a missing flush() or such.

comment:5 Changed 3 years ago by diver

  • Owner set to dmik
  • Status changed from new to assigned

comment:6 Changed 3 years ago by dmik

  • Resolution set to wontfix
  • Status changed from assigned to 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.

Note: See TracTickets for help on using tickets.