[Pkg-scicomp-devel] Bug#494031: Signal handlers not working?

Jurij Smakov jurij at wooyd.org
Thu Aug 28 08:25:39 UTC 2008


It appears that my initial analysis was not completely correct. The 
signal handlers are working, sort of. The first SIGBUS which the 
program gets is handled correctly, and then control is returned back 
to the program, however second one is not trapped and delivered to the 
program, which kills it. I don't know enough about the subtleties of 
signal handling in C (and it appears that there is an awful lot of 
them), but I've ran into the following piece of information while 
reading about it:

"On systems that support signal handling, POSIX.1 does not specify 
whether setjmp and longjmp save or restore the current set of blocked 
signals - if a program employs signal handling it should use POSIX's 
sigsetjmp/siglongjmp." [0]

As we are handling signals, it appears that sigsetjmp/siglongjmp are 
the right thing to use, instead of their sig-less counterparts. I 
was able to come up with a simple test case (attached) which 
demonstrates the problem: while I would expect both SIGBUS'es to be 
caught by the handler, that's what I see on sparc when I run it:

root at groovy:/tmp# ./a.out 
Caught signal 10
Back at setjmp #1
Bus error

Replacing setjmp/longjump with sigsetjmp/siglongjump makes program to 
behave correctly. I've tried doing it for H5detect.c (using the 
attached patch) and the problem is now gone, H5detect runs fine and 
H5Tinit.c is generated successfully.

Unfortunately, the build now fails in a different place:

[ 77%] Building CXX object Servers/ServerManager/CMakeFiles/vtkPVServerManager.dir/vtkSMCameraManipulatorProxy.o
[ 77%] Building CXX object Servers/ServerManager/CMakeFiles/vtkPVServerManager.dir/vtkSMCameraProxy.o
In file included from /usr/include/stdio.h:903,
                 from /usr/include/c++/4.3/cstdio:50,
                 from /usr/include/c++/4.3/bits/char_traits.h:48,
                 from /usr/include/c++/4.3/ios:46,
                 from /usr/include/c++/4.3/ostream:45,
                 from /usr/include/c++/4.3/iostream:45,
                 from /tmp/paraview-3.2.3/VTK/Common/vtkIOStream.h:35,
                 from /tmp/paraview-3.2.3/VTK/Common/vtkSystemIncludes.h:40,
                 from /tmp/paraview-3.2.3/VTK/Common/vtkIndent.h:24,
                 from /tmp/paraview-3.2.3/VTK/Common/vtkObjectBase.h:43,
                 from /tmp/paraview-3.2.3/VTK/Common/vtkObject.h:41,
                 from /tmp/paraview-3.2.3/Servers/ServerManager/vtkSMObject.h:24,
                 from /tmp/paraview-3.2.3/Servers/ServerManager/vtkSMProxy.h:123,
                 from /tmp/paraview-3.2.3/Servers/ServerManager/vtkSMCameraProxy.h:23,
                 from /tmp/paraview-3.2.3/Servers/ServerManager/vtkSMCameraProxy.cxx:15:
/usr/include/bits/stdio.h: In function 'int putchar_unlocked(int)':
/usr/include/bits/stdio.h:108: error: expected primary-expression before 'unsigned'
/usr/include/bits/stdio.h:108: error: expected `)' before 'unsigned'
/usr/include/bits/stdio.h:108: error: expected `)' before ';' token
make[3]: *** [Servers/ServerManager/CMakeFiles/vtkPVServerManager.dir/vtkSMCameraProxy.o] Error 1
make[3]: Leaving directory `/tmp/paraview-3.2.3/obj-sparc-linux-gnu'
make[2]: *** [Servers/ServerManager/CMakeFiles/vtkPVServerManager.dir/all] Error 2
make[2]: Leaving directory `/tmp/paraview-3.2.3/obj-sparc-linux-gnu'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/paraview-3.2.3/obj-sparc-linux-gnu'
make: *** [debian/stamp-makefile-build] Error 2

I'll try to investigate what happens here.

[0] http://en.wikipedia.org/wiki/Longjmp

Cheers.
-- 
Jurij Smakov                                           jurij at wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.c
Type: text/x-csrc
Size: 510 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-scicomp-devel/attachments/20080828/ffda43a6/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paraview.patch
Type: text/x-diff
Size: 1820 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-scicomp-devel/attachments/20080828/ffda43a6/attachment.patch 


More information about the Pkg-scicomp-devel mailing list