[Python-bugs-list] bug (Incorrect signal processing) - Python 1.5.2 (PR#102)

Vladimir.Benes@pvt.cz Vladimir.Benes@pvt.cz
Mon, 11 Oct 1999 09:45:56 -0400 (EDT)


Good afternoon,

    I have found a bug on Python 1.5.2. This bug doesn't occur on Python
1.5.1.

Python versions and OS:
- Python 1.5.1. at Debian GNU/Linux 2.0.36
- Python 1.5.2. at Debian GNU/Linux 2.2.9

Bug: Incorrect signal processing (Python 1.5.2).
    Process can assign procedure for signal processing. When process is
waiting at system call and this signal occur, then the signal assigned
procedure is otherwise correctly completed but then waiting at system call
is broken and process continues.

    Here is a simple program for demonstrate this bug:

#!/usr/bin/python
import signal
import sys

def signal_handle(signum, frame) :
  signal.signal(signal.SIGALRM, signal_handle)
  signal.alarm(2)
  print "signal"

signal_handle(0,0)
a=sys.stdin.readline()
print "Line examined..."
b=sys.stdin.readline()
print "Line examined..."
print a,b,"end"
# end of example

    Correct behaviour: Message "Line examined..." occurs only after pressing
ENTER by user.
    Bug: Message "Line examined..." occurs immediately after signal occured
and procedure signal_handle finished. Output then look thus (when no input
entered):

signal
signal
Line examined...
signal
Line examined...
  end

    This bug appears at any signal occur and whatever process waiting at
system call. Some system call even produces exception (e.g. waiting for data
or connection on socket).

    Bug is perhaps caused by wrong seting "siginterrupt" on module signal. I
haven't found any way how call in Python program "siginterrupt" for correct
behavior of signal processing.

        Good bye, V. Benes

****************************************************************************
    Ing. Vladimir Benes, pvt.net
    PVT, a.s., OZ Chomutov
    e-mail: vladimir.benes@pvt.cz, vladimir.benes@sms.paegas.cz
****************************************************************************