[ python-Bugs-856706 ] popen3 under threads reports different stderr results

SourceForge.net noreply at sourceforge.net
Fri Dec 12 05:03:13 EST 2003


Bugs item #856706, was opened at 2003-12-09 01:08
Message generated for change (Comment added) made by gaul
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=856706&group_id=5470

Category: Threads
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Steven Howe (stevenhowe)
Assigned to: Nobody/Anonymous (nobody)
Summary: popen3 under threads reports different stderr results

Initial Comment:
Using os.popen3 inside a thread (start_new_thread)
returns different results from the stderr file dev.

I discovered this while trying to trap badblocks
program output. I have usb floppy I am trying to
format, after a badblock check. My floppy is on /dev/sdb.

code:
import thread
import os
def dd( outfilename ):
   cmd='/sbin/badblocks -n -s -v -c 16 -b 512 /dev/sdb'
   channels = os.popen3( cmd )
   ch = ' '
   ff = '/tmp/%s' % outfilename
   out=open( ff ,'w')
   while ch != '':
      ch = channels[2].read(1)
      out.write( ch )

Run two ways. First as a stand alone code. Then as a
threaded program.  

def( 'nothread.err' )
thead.start_new_thread( def, ( 'thread.err' ) )
---------------
Now view the results with od -ta. You will see that the
results are very different. All the the verbose data,
on current blocks completed, are missing.

Steven Howe


      

----------------------------------------------------------------------

Comment By: Andrew Gaul (gaul)
Date: 2003-12-12 04:03

Message:
Logged In: YES 
user_id=139865

Confirmed with Python CVS and Fedora on x86. 
e2fsprogs/misc/badblocks:alarm_intr sets a SIGALRM handler
and calls alarm(1), but it is not getting fired.  I will
look into this further.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=856706&group_id=5470



More information about the Python-bugs-list mailing list