[pkg-boost-devel] Bug#552383: boost1.40: FTBFS on hurd-i386: usage of sa_sigaction and conflict with Hurd header

Pino Toscano pino at kde.org
Sun Oct 25 21:12:59 UTC 2009


Package: boost1.40
Version: 1.40.0-2
Severity: important
Tags: patch
User: debian-hurd at lists.debian.org
Usertags: hurd

Hi,

currently boost cannot be compiled on GNU/Hurd because of two problems:
a) a constant in Hurd's bits/errno.h conflict with a local variable
b) usage of sigaction::sa_handler (SA_SIGINFO is not defined, so there's only
   the basic sa_handler available)

The attached patch both the issues. Please note the 'ED' problem is an
Hurd-specific one, so better keep the patch locally in Debian.

Thanks,
-- 
Pino
-------------- next part --------------
Various changes for GNU/Hurd:
* rename a 'ED' variable to 'ED_' to avoid conflict with the Hurd error 'ED' defined in bits/errno.h
* #ifdef the usage of SA_SIGINFO and related sa_sigaction, and use a simple sa_handler accordingly

--- boost1.40-1.40.0.orig/boost/math/special_functions/ellint_rd.hpp
+++ boost1.40-1.40.0/boost/math/special_functions/ellint_rd.hpp
@@ -29,7 +29,7 @@
 T ellint_rd_imp(T x, T y, T z, const Policy& pol)
 {
     T value, u, lambda, sigma, factor, tolerance;
-    T X, Y, Z, EA, EB, EC, ED, EE, S1, S2;
+    T X, Y, Z, EA, EB, EC, ED_, EE, S1, S2;
     unsigned long k;
 
     BOOST_MATH_STD_USING
@@ -93,9 +93,9 @@
     EA = X * Y;
     EB = Z * Z;
     EC = EA - EB;
-    ED = EA - 6 * EB;
-    EE = ED + EC + EC;
-    S1 = ED * (ED * T(9) / 88 - Z * EE * T(9) / 52 - T(3) / 14);
+    ED_ = EA - 6 * EB;
+    EE = ED_ + EC + EC;
+    S1 = ED_ * (ED_ * T(9) / 88 - Z * EE * T(9) / 52 - T(3) / 14);
     S2 = Z * (EE / 6 + Z * (-EC * T(9) / 22 + Z * EA * T(3) / 26));
     value = 3 * sigma + factor * (1 + S1 + S2) / (u * sqrt(u));
 
--- boost1.40-1.40.0.orig/boost/test/impl/execution_monitor.ipp
+++ boost1.40-1.40.0/boost/test/impl/execution_monitor.ipp
@@ -264,22 +264,37 @@
 public:
     // Constructor
     system_signal_exception()
+#ifdef SA_SIGINFO
     : m_sig_info( 0 )
     , m_context( 0 )
+#else
+    : m_sig( 0 )
+#endif
     {}
 
     // Access methods
+#ifdef SA_SIGINFO
     void        operator()( siginfo_t* i, void* c )
     {
         m_sig_info  = i;
         m_context   = c;
     }
+#else
+    void        operator()( int s )
+    {
+        m_sig       = s;
+    }
+#endif
     void        report() const;
 
 private:
     // Data members
+#ifdef SA_SIGINFO
     siginfo_t*  m_sig_info; // system signal detailed info
     void*       m_context;  // signal context
+#else
+    int         m_sig;      // sistem signal
+#endif
 };
 
 //____________________________________________________________________________//
@@ -287,6 +302,7 @@
 void
 system_signal_exception::report() const
 {
+#ifdef SA_SIGINFO
     if( !m_sig_info )
         return; // no error actually occur?
 
@@ -571,6 +587,59 @@
     default:
         report_error( execution_exception::system_error, "unrecognized signal" );
     }
+#else
+    if( !m_sig )
+        return; // no error actually occur?
+
+    switch( m_sig ) {
+    case SIGILL:
+        report_error( execution_exception::system_fatal_error, 
+                      "signal: SIGILL (illegal instruction)" ); 
+        break;
+
+    case SIGFPE:
+        report_error( execution_exception::system_error,
+                      "signal: SIGFPE (errnoneous arithmetic operations)" );
+        break;
+
+    case SIGSEGV:
+        report_error( execution_exception::system_fatal_error,
+                      "signal: SIGSEGV (memory access violation)" );
+        break;
+
+    case SIGBUS:
+        report_error( execution_exception::system_fatal_error,
+                      "signal: SIGSEGV (memory access violation)" );
+        break;
+
+    case SIGCHLD:
+        report_error( execution_exception::system_fatal_error,
+                      "signal: SIGCHLD (child process has terminated)" );
+        break;
+
+#if defined(BOOST_TEST_CATCH_SIGPOLL)
+
+    case SIGPOLL:
+        report_error( execution_exception::system_error, 
+                      "signal: SIGPOLL (asynchronous I/O event occured)" ); 
+        break;
+
+#endif
+
+    case SIGABRT:
+        report_error( execution_exception::system_error,
+                      "signal: SIGABRT (application abort requested)" );
+        break;
+
+    case SIGALRM:
+        report_error( execution_exception::timeout_error,
+                      "signal: SIGALRM (timeout while executing function)" );
+        break;
+
+    default:
+        report_error( execution_exception::system_error, "unrecognized signal" );
+    }
+#endif
 }
 
 //____________________________________________________________________________//
@@ -581,8 +650,13 @@
 
 // Forward declaration
 extern "C" {
+#ifdef SA_SIGINFO
 static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context );
 static void execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context );
+#else
+static void execution_monitor_jumping_signal_handler( int sig );
+static void execution_monitor_attaching_signal_handler( int sig );
+#endif
 }
 
 class signal_action {
@@ -625,9 +699,14 @@
         return;
     }
 
+#ifdef SA_SIGINFO
     m_new_action.sa_flags     |= SA_SIGINFO;
     m_new_action.sa_sigaction  = attach_dbg ? &execution_monitor_attaching_signal_handler
                                             : &execution_monitor_jumping_signal_handler;
+#else
+    m_new_action.sa_handler = attach_dbg ? &execution_monitor_attaching_signal_handler
+                                         : &execution_monitor_jumping_signal_handler;
+#endif
     BOOST_TEST_SYS_ASSERT( sigemptyset( &m_new_action.sa_mask ) != -1 );
 
 #ifdef BOOST_TEST_USE_ALT_STACK
@@ -769,6 +848,7 @@
 
 extern "C" {
 
+#ifdef SA_SIGINFO
 static bool ignore_sigchild( siginfo_t* info )
 {
     return info->si_signo == SIGCHLD
@@ -781,9 +861,16 @@
             && (int)info->si_status == 0;
 #endif
 }
+#else
+static bool ignore_sigchild( int sig )
+{
+    return sig == SIGCHLD;
+}
+#endif
 
 //____________________________________________________________________________//
 
+#ifdef SA_SIGINFO
 static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context )
 {
     if( ignore_sigchild( info ) )
@@ -810,6 +897,34 @@
 
 //____________________________________________________________________________//
 
+#else
+static void execution_monitor_jumping_signal_handler( int sig )
+{
+    if( ignore_sigchild( sig ) )
+        return;
+
+    signal_handler::sys_sig()( sig );
+
+    siglongjmp( signal_handler::jump_buffer(), sig );
+}
+
+//____________________________________________________________________________//
+
+static void execution_monitor_attaching_signal_handler( int sig )
+{
+    if( ignore_sigchild( sig ) )
+        return;
+
+    if( !debug::attach_debugger( false ) )
+        execution_monitor_jumping_signal_handler( sig );
+
+    // debugger attached; it will handle the signal
+    BOOST_TEST_SYS_ASSERT( ::signal( sig, SIG_DFL ) != SIG_ERR );
+}
+#endif
+
+//____________________________________________________________________________//
+
 }
 
 } // namespace detail


More information about the pkg-boost-devel mailing list