- in signal.c use pthread_sigmask instead of sigprocmask,
  behaviour of sigprocmask is undefined in threaded programs.
  In 1.9 series the code already uses pthread_sigmask.

[...]

--- ruby1.8-1.8.7.299.orig/signal.c
+++ ruby1.8-1.8.7.299/signal.c
@@ -21,6 +21,7 @@
 #undef SIGBUS
 #endif

+#define sigprocmask pthread_sigmask
 #if defined HAVE_SIGPROCMASK || defined HAVE_SIGSETMASK
 #define USE_TRAP_MASK 1
 #else

Isn't that really an hackish way to fix this?

Yes, the proper way should be

sed -i s/sigprocmask/pthread_sigmask/ configure.in
sed -i s/sigprocmask/pthread_sigmask/ signal.c
sed -i s/SIGPROCMASK/PTHREAD_SIGMASK/ signal.c

and regenerate configure

Could you comment on whether FreeBSD itself would be affected too? That
could help "sell" the patch to upstream.

I do not know, but the undefined behaviour is stated in POSIX,
http://www.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html

And ChangeLog of ruby 1.9.x might help too:

Sat Apr 24 00:41:52 2010  Yusuke Endoh  <[email protected]>

        * signal.c: use pthread_sigmask() instead of sigprocmask().
          sigprocmask() is unspecified behavior on multi-thread programs.
          [ruby-core:25217]


Petr




--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to