timeout.c warning about returning undefined value

2009-08-31 Thread Jim Meyering
Hi Pádraig, clang reports this: timeout.c:330:9: warning: Uninitialized or undefined value returned to caller. return status; ^ Even if it really can't happen (which the comment suggests), please initialize status or ensure that we get a diagnostic and exit nonzero if/when

Re: timeout.c warning about returning undefined value

2009-08-31 Thread Pádraig Brady
Jim Meyering wrote: Hi Pádraig, clang reports this: timeout.c:330:9: warning: Uninitialized or undefined value returned to caller. return status; ^ Even if it really can't happen (which the comment suggests), please initialize status or ensure that we get

Re: timeout.c warning about returning undefined value

2009-08-31 Thread Jim Meyering
Pádraig Brady wrote: I'll check in the attached later on today unless there are objections. ... Subject: [PATCH] timeout: defensive handling of all wait() errors * src/timeout.c (main): Handle all possible cases of unexpected failures from wait(). This was prompted by the clang tool

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2009-02-28 Thread Jim Meyering
Paul Eggert wrote: Eric Blake e...@byu.net writes: I just checked POSIX, and this is entirely true - the exec*() family is allowed to inherit an ignored SIGCHLD, in deference to older systems like SysV; and wait()/waitpid() are allowed to fail with ECHILD if SIGCHLD is ignored. But most

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2009-02-28 Thread Bruno Haible
Jim Meyering wrote: [reviving an old thread...] This was a reply to http://lists.gnu.org/archive/html/bug-coreutils/2008-10/msg00216.html, for those who - like me - lost the context after 4 months. I confirmed that running with SIGCHLD ignored, and regardless of which wait function it uses

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2009-02-28 Thread Jim Meyering
Bruno Haible wrote: Jim Meyering wrote: [reviving an old thread...] This was a reply to http://lists.gnu.org/archive/html/bug-coreutils/2008-10/msg00216.html, for those who - like me - lost the context after 4 months. I confirmed that running with SIGCHLD ignored, and regardless of which

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2009-02-28 Thread Bruno Haible
Jim Meyering wrote: the change I could apply is to add a comment in the specification: This function assumes that the signal handler for SIGCHLD is not set to SIG_IGN. Thanks. That's probably all that it can do. Done, see below. Though isn't it better to say it assumes the handler

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2009-02-28 Thread Bruce Korb
Hey, I remember this! There was a long discussion about SIGCHLD vs. SIGCLD / SysVR4 vs. BSD on the Austin reflector. implementations are now allowed to reset the handler to SIG_DFL on exec(2), so it is may not work not will not work. Anyway, the final answer is that all programs that want their

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2009-02-28 Thread Bruno Haible
Bruce Korb wrote: implementations are now allowed to reset the handler to SIG_DFL on exec(2) Ah, an improvement indeed. so it is may not work not will not work. No, it's still will not work because the text is talking about the setting of SIGCHLD in the process that it calling

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-18 Thread Bruno Haible
Eric Blake wrote: 3. switch to the gnulib execute module, which makes this code portable to mingw (the current fork/exec sequence excludes mingw, which lacks fork), Jim Meyering wrote: #3 sounds like it's worth a try, at least. Note that we have now posix_spawn() portable to all Unix

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-18 Thread Bruno Haible
Hi Eric, When used in a library, the gnulib fatal-signal module must assume that the rest of the program can use SIGPOLL and SIGALRM for its own purposes. But when used in a stand-alone app, such as csplit, where it is known in advance that these signals are not used, it would be nice to

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-16 Thread Jim Meyering
Eric Blake [EMAIL PROTECTED] wrote: ... Subject: [PATCH] csplit: prefer sigaction over signal * bootstrap.conf (gnulib_modules): Import sigaction. * src/csplit.c (sigprocmask, siginterrupt) [SA_NOCLDSTOP]: Delete workarounds. (interrupt_handler, main): Drop use of signal. Rely on sigaction

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-16 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [adding bug-gnulib] According to Jim Meyering on 10/16/2008 1:30 AM: Eric Blake [EMAIL PROTECTED] wrote: ... Subject: [PATCH] csplit: prefer sigaction over signal * bootstrap.conf (gnulib_modules): Import sigaction. * src/csplit.c (sigprocmask,

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-16 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 10/10/2008 7:15 AM: I've wanted to get rid of signal uses for ages. Are you interested in doing it? Yes, I'll tackle this. Round 2 begins with a question. src/install.c has the following use of signal, needed on the

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-16 Thread Jim Meyering
Eric Blake [EMAIL PROTECTED] wrote: According to Eric Blake on 10/10/2008 7:15 AM: I've wanted to get rid of signal uses for ages. Are you interested in doing it? Yes, I'll tackle this. Round 2 begins with a question. src/install.c has the following use of signal, needed on the code path

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-16 Thread Paul Eggert
Eric Blake [EMAIL PROTECTED] writes: I just checked POSIX, and this is entirely true - the exec*() family is allowed to inherit an ignored SIGCHLD, in deference to older systems like SysV; and wait()/waitpid() are allowed to fail with ECHILD if SIGCHLD is ignored. But most systems these days

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-13 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 10/10/2008 7:15 AM: I've wanted to get rid of signal uses for ages. Are you interested in doing it? Yes, I'll tackle this. Round 1: csplit. The use of signal here mirrors what Bruno's fatal-signal module in gnulib

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-11 Thread Jim Meyering
Giuseppe Scrivano [EMAIL PROTECTED] wrote: do you have suggestions on this patch? It replaces any `signal' with `sigaction'. Regards, Giuseppe Scrivano Jim Meyering [EMAIL PROTECTED] writes: Good idea. I've wanted to get rid of signal uses for ages. Are you interested in doing it?

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-11 Thread Giuseppe Scrivano
Hello, Jim Meyering [EMAIL PROTECTED] writes: Giuseppe, Perhaps you misunderstood? Eric proposed that idea and I addressed the reply above to him. He then replied that he would indeed like to implement it. Sorry, I thought it was directed to both. Since you have spent time working on it,

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-11 Thread Jim Meyering
Pádraig Brady [EMAIL PROTECTED] wrote: Eric Blake wrote: On the other hand, POSIX is explicit that mixing signal and sigaction is not portable. For that matter, now that gnulib provides a guaranteed sigaction, why don't we just change all of coreutils to use it? Affected are: csplit, dd,

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-11 Thread Andreas Schwab
Giuseppe Scrivano [EMAIL PROTECTED] writes: + memset (sa, 0, sizeof sa); + sigemptyset (sa.sa_mask); I don't think you need the memset. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-11 Thread Giuseppe Scrivano
Andreas Schwab [EMAIL PROTECTED] writes: + memset (sa, 0, sizeof sa); + sigemptyset (sa.sa_mask); I don't think you need the memset. and how reset the struct without a memset or using sa = {0,} as Pádraig suggested? Do you advise me to reset manually only members that really must be 0?

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-11 Thread Andreas Schwab
Giuseppe Scrivano [EMAIL PROTECTED] writes: Andreas Schwab [EMAIL PROTECTED] writes: + memset (sa, 0, sizeof sa); + sigemptyset (sa.sa_mask); I don't think you need the memset. and how reset the struct without a memset or using sa = {0,} as Pádraig suggested? You only need to

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-10 Thread Pádraig Brady
Giuseppe Scrivano wrote: Hi Pádraig, I think that the only problem can raise when the sent signal is received by the monitor process after the handler is reinstalled. In that case the signal will be dispatched again to the process group. This can repeat again and again until it is finally

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-10 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 10/10/2008 6:44 AM: On the other hand, POSIX is explicit that mixing signal and sigaction is not portable. For that matter, now that gnulib provides a guaranteed sigaction, why don't we just change all of coreutils to

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-10 Thread Pádraig Brady
Eric Blake wrote: On the other hand, POSIX is explicit that mixing signal and sigaction is not portable. For that matter, now that gnulib provides a guaranteed sigaction, why don't we just change all of coreutils to use it? Affected are: csplit, dd, install, ls, nohup, sort, tee, and

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-10 Thread Pádraig Brady
Giuseppe Scrivano wrote: Hello, do you have suggestions on this patch? It replaces any `signal' with `sigaction'. [snip] diff --git a/src/timeout.c b/src/timeout.c index 8b506f0..6ef7218 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -278,8 +278,6 @@ main (int argc, char **argv

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-10 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Giuseppe Scrivano on 10/10/2008 2:34 PM: Hello, do you have suggestions on this patch? It replaces any `signal' with `sigaction'. The size of this patch is not trivial; are you willing to assign copyright to FSF? If so, I can get

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-09 Thread Pádraig Brady
Pádraig Brady wrote: Giuseppe Scrivano wrote: Hello, what do you think about the following way to remove the sigs_to_ignore hack in the timeout.c file? It ignores temporarily the signal inside the `send_sig' function instead of using the `sigs_to_ignore' array. I'll test this tonight

Re: [PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-07 Thread Pádraig Brady
Giuseppe Scrivano wrote: Hello, what do you think about the following way to remove the sigs_to_ignore hack in the timeout.c file? It ignores temporarily the signal inside the `send_sig' function instead of using the `sigs_to_ignore' array. I'll test this tonight, as this stuff is tricky

[PATCH] Replacement for the sigs_to_ignore hack in timeout.c

2008-10-06 Thread Giuseppe Scrivano
Hello, what do you think about the following way to remove the sigs_to_ignore hack in the timeout.c file? It ignores temporarily the signal inside the `send_sig' function instead of using the `sigs_to_ignore' array. Regards, Giuseppe Scrivano diff --git a/src/timeout.c b/src/timeout.c index

timeout.c

2007-07-03 Thread Robert Millan [ackstorm]
be nice to have it in GNU coreutils. Would you please consider it? See attachment. -- Robert Millan /* * timeout.c -- run commands with a specified timeout * Copyright (C) 2007 Robert Millan [EMAIL PROTECTED] * * GRUB is free software; you can redistribute it and/or modify * it under

Re: timeout.c

2007-07-03 Thread Pádraig Brady
Robert Millan [ackstorm] wrote: [ Please keep [EMAIL PROTECTED] on CC ] Hi! I just discovered that the timeout(1) utility written by Dan Farmer on 1999 (http://www.porcupine.org/forensics/) is not free software (modification is forbidden). Since the program is small, I decided to

Re: timeout.c

2007-07-03 Thread Pádraig Brady
-software/tct-blockhash/src/misc/timeout.c is taken from satan-1.1.1/src/misc/timeout.c written by Wietse Venema, which has the following BSD like licence: http://www.porcupine.org/satan/demo/docs/copyright.html Pádraig. ___ Bug-coreutils mailing list Bug

Re: timeout.c

2007-07-03 Thread Bob Proulx
trying to do it all at once. So I am leaning toward saying that it would be better waiting. I don't feel strongly about it though. But I have some comments on the code regardless. /* * timeout.c -- run commands with a specified timeout * Copyright (C) 2007 Robert Millan [EMAIL PROTECTED

Re: timeout.c

2007-07-03 Thread Robert Millan
(modification is forbidden). Note for completeness, /forensic-discovery-software/tct-blockhash/src/misc/timeout.c is taken from satan-1.1.1/src/misc/timeout.c written by Wietse Venema, which has the following BSD like licence: http://www.porcupine.org/satan/demo/docs/copyright.html BSD-like