coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#8938: make timeout and CTRL-C


From: Pádraig Brady
Subject: Re: bug#8938: make timeout and CTRL-C
Date: Thu, 25 Aug 2011 11:35:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

On 08/25/2011 11:15 AM, Pádraig Brady wrote:
> On 07/07/2011 11:14 AM, Pádraig Brady wrote:
>> I'm also thinking of pushing this as a separate patch,
>> which will set WIFSIGNALED for the timeout process itself.
>> This will make timeout more transparent and when doing
>> Ctrl-C from make for example, printing "[target] Interrupt"
>> rather than "[target] Error 130".
>>
>> diff --git a/src/timeout.c b/src/timeout.c
>> index a686225..ea4af18 100644
>> --- a/src/timeout.c
>> +++ b/src/timeout.c
>> @@ -341,7 +361,19 @@ main (int argc, char **argv)
>>            if (WIFEXITED (status))
>>              status = WEXITSTATUS (status);
>>            else if (WIFSIGNALED (status))
>> -            status = WTERMSIG (status) + 128; /* what sh does at least.  */
>> +            {
>> +              int sig = WTERMSIG (status);
>> +              if (!timed_out)
>> +                {
>> +                  /* exit with the signal flag set, but avoid core files.  
>> */
>> +                  if (setrlimit (RLIMIT_CORE, &(struct rlimit) {0,0}) == 0)
>> +                    {
>> +                      signal (sig, SIG_DFL);
>> +                      raise (sig);
>> +                    }
>> +                }
>> +              status = sig + 128; /* what sh returns for signaled 
>> processes.  */
>> +            }
> 
> Seems like it might be safer to revert this,
> as one can't really disable core dumps for a process on linux:
> http://marc.info/?l=linux-kernel&m=131426663119428&w=2
> So abrt would log bugs against coreutils rather than a program
> that `timeout` was monitoring.

I'm committing this revert now...

>From d00c73cf4d6402dbacc7cd587127a16a0e93724c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Thu, 25 Aug 2011 11:25:30 +0100
Subject: [PATCH] timeout: revert signal propagation enhancement

This effectively reverts the unreleased commit 5a647a05

* src/timeout.c (main): Don't propagate signals from the monitored
process, as on Linux /proc/sys/kernel/core_pattern could still
handle them and cause false reports against `timeout`
---
 src/timeout.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/timeout.c b/src/timeout.c
index 6a37508..ae89942 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -424,7 +424,9 @@ main (int argc, char **argv)
           else if (WIFSIGNALED (status))
             {
               int sig = WTERMSIG (status);
-#if HAVE_SETRLIMIT && defined RLIMIT_CORE
+/* The following is not used as one cannot disable processing
+   by a filter in /proc/sys/kernel/core_pattern on Linux.  */
+#if 0 && HAVE_SETRLIMIT && defined RLIMIT_CORE
               if (!timed_out)
                 {
                   /* exit with the signal flag set, but avoid core files.  */
-- 
1.7.5.2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]