Hello community, here is the log from the commit of package yast2-core for openSUSE:Factory checked in at 2015-10-28 17:15:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-core (Old) and /work/SRC/openSUSE:Factory/.yast2-core.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-core" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-core/yast2-core.changes 2015-06-06 09:49:49.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-core.new/yast2-core.changes 2015-10-28 17:15:24.000000000 +0100 @@ -1,0 +2,7 @@ +Tue Oct 6 14:44:02 UTC 2015 - [email protected] + +- In the signal handler, log the sender PID, and if present, + run /usr/lib/YaST2/bin/signal-postmortem (bsc#935686). +- 3.1.18 + +------------------------------------------------------------------- Old: ---- yast2-core-3.1.17.tar.bz2 New: ---- yast2-core-3.1.18.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-core.spec ++++++ --- /var/tmp/diff_new_pack.aZeLxB/_old 2015-10-28 17:15:24.000000000 +0100 +++ /var/tmp/diff_new_pack.aZeLxB/_new 2015-10-28 17:15:24.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-core -Version: 3.1.17 +Version: 3.1.18 Release: 0 Url: https://github.com/yast/yast-core ++++++ yast2-core-3.1.17.tar.bz2 -> yast2-core-3.1.18.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-core-3.1.17/liby2/src/genericfrontend.cc new/yast2-core-3.1.18/liby2/src/genericfrontend.cc --- old/yast2-core-3.1.17/liby2/src/genericfrontend.cc 2015-06-01 13:54:08.000000000 +0200 +++ new/yast2-core-3.1.18/liby2/src/genericfrontend.cc 2015-10-22 14:19:12.000000000 +0200 @@ -92,6 +92,7 @@ #include <errno.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/wait.h> #include <sstream> #include <iomanip> #include <string> @@ -234,16 +235,45 @@ } } +static +void +signal_postmortem_program () +{ + pid_t cpid; + cpid = fork(); + + if (cpid == -1) + { + // could not fork; too bad, no postmortem + } + else if (cpid == 0) + { + // in child + // EXECCOMPDIR is usually /usr/lib/YaST2 + const char * prog = EXECCOMPDIR "/bin/signal-postmortem"; + execl(prog, prog, NULL); + // error, probably the program is not there + _exit(EXIT_FAILURE); + } + else + { + // in parent + wait(NULL); + } +} + void -signal_handler (int sig) +signal_handler (int sig, siginfo_t *si, void * /* unused_ucontext */) { signal (sig, SIG_IGN); // bnc#493152#c19 only signal-safe functions are allowed - char buffer[200]; + char buffer[300]; int n = snprintf (buffer, sizeof(buffer), - "YaST got signal %d at file %s:%d\n", - sig, YaST::ee.filename().c_str(), YaST::ee.linenumber()); + "YaST got signal %d at file %s:%d\n" + " sender PID: %ld\n", + sig, YaST::ee.filename().c_str(), YaST::ee.linenumber(), + (long) si->si_pid); if (n >= (int)sizeof(buffer) || n < 0) strcpy (buffer, "YaST got a signal.\n"); signal_log_to_fd (STDERR_FILENO, buffer); @@ -264,11 +294,36 @@ perror ("log close"); } + signal_postmortem_program(); + // bye signal (sig, SIG_DFL); kill ( getpid (), sig); } +static +void +signal_handler_setup () +{ + // Ignore SIGPIPE. No use in signals. Signals can't be assigned to + // components + signal(SIGPIPE, SIG_IGN); + + struct sigaction sa; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_SIGINFO; + sa.sa_sigaction = signal_handler; + + // Give some output for the SIGSEGV + // and other signals too, #238172 + // Note that USR1 and USR2 are handled by the logger. + for (int signum : { SIGHUP, SIGINT, SIGQUIT, SIGILL, + SIGABRT, SIGFPE, SIGSEGV, SIGTERM }) + { + if (sigaction(signum, &sa, NULL) == -1) + fprintf(stderr, "sigaction failed for signum %d\n", signum); + } +} void parse_client_and_options (int argc, char ** argv, int& arg, char *& client_name, YCPList& arglist) @@ -497,21 +552,7 @@ progname = basename (argv[0]); // get program name - // Ignore SIGPIPE. No use in signals. Signals can't be assigned to - // components - signal(SIGPIPE, SIG_IGN); - - // Give some output for the SIGSEGV - // and other signals too, #238172 - // Note that USR1 and USR2 are handled by the logger. - signal (SIGHUP, signal_handler); - signal (SIGINT, signal_handler); - signal (SIGQUIT, signal_handler); - signal (SIGILL , signal_handler); - signal (SIGABRT, signal_handler); - signal (SIGFPE, signal_handler); - signal (SIGSEGV, signal_handler); - signal (SIGTERM, signal_handler); + signal_handler_setup(); if (argc < 2) { fprintf (stderr, "\nToo few arguments"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-core-3.1.17/package/yast2-core.changes new/yast2-core-3.1.18/package/yast2-core.changes --- old/yast2-core-3.1.17/package/yast2-core.changes 2015-06-01 13:54:08.000000000 +0200 +++ new/yast2-core-3.1.18/package/yast2-core.changes 2015-10-22 14:19:13.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Tue Oct 6 14:44:02 UTC 2015 - [email protected] + +- In the signal handler, log the sender PID, and if present, + run /usr/lib/YaST2/bin/signal-postmortem (bsc#935686). +- 3.1.18 + +------------------------------------------------------------------- Wed May 13 19:56:50 CEST 2015 - [email protected] - Fix more compilation warnings. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-core-3.1.17/package/yast2-core.spec new/yast2-core-3.1.18/package/yast2-core.spec --- old/yast2-core-3.1.17/package/yast2-core.spec 2015-06-01 13:54:08.000000000 +0200 +++ new/yast2-core-3.1.18/package/yast2-core.spec 2015-10-22 14:19:13.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-core -Version: 3.1.17 +Version: 3.1.18 Release: 0 Url: https://github.com/yast/yast-core
