Wrong exist status for os.system, os.poepen, etc.

Paolo Pantaleo paolopantaleo at gmail.com
Tue Mar 6 10:39:51 EST 2007


Subject: python2.4: Wrong exist status for os.system, os.poepen, etc.
Package: python2.4
Version: 2.4.4-2
Severity: normal



-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (800, 'testing'), (70, 'stable'), (60, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-k7
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)

I send this to python-list also, so someone can tell if he/she can
(not) reproduce
the same behavior

The os.system() (but all the other funciont with similar behavior) reports
wrong exit status. I can reproduce the bug in the following way

create /tmp/x.c:

#include <stdlib.h>

int main(void){
        exit(20);
}

$ cd /tmp
$ make x

$./x
$echo $?
20

$ python

give the following commands:

>>> import os
>>> os.system("/tmp/x")
5120

the same for

>>> x=os.popen("/tmp/x")
>>> x.read()
''
>>> x.close()
5120


Greetings
PAolo



Versions of packages python2.4 depends on:
ii  libbz2-1.0                  1.0.3-6      high-quality block-sorting file co
ii  libc6                       2.3.6.ds1-10 GNU C Library: Shared libraries
ii  libdb4.4                    4.4.20-8     Berkeley v4.4 Database Libraries [
ii  libncursesw5                5.5-5        Shared libraries for terminal hand
ii  libreadline5                5.2-2        GNU readline and history libraries
ii  libssl0.9.8                 0.9.8c-4     SSL shared libraries
ii  mime-support                3.39-1       MIME files 'mime.types' & 'mailcap
ii  python2.4-minimal           2.4.4-2      A minimal subset of the Python lan

python2.4 recommends no packages.

-- no debconf information



More information about the Python-list mailing list