From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: "Joachim Schmitz" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 14 Jul 2011 06:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 9076@debbugs.gnu.org X-Debbugs-Original-To: Received: via spool by submit@debbugs.gnu.org id=B.131062652231565 (code B ref -1); Thu, 14 Jul 2011 06:56:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2011 06:55:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhFpR-0008D3-PW for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhFpP-0008Cp-Bg for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhFpI-0008Fi-Dx for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:47124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhFpI-0008Fe-5P for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:12 -0400 Received: from eggs.gnu.org ([140.186.70.92]:46446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhFpG-0007kS-HN for bug-coreutils@gnu.org; Thu, 14 Jul 2011 02:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhFpD-0008DH-US for bug-coreutils@gnu.org; Thu, 14 Jul 2011 02:55:10 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:52347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhFpD-0008B8-B2 for bug-coreutils@gnu.org; Thu, 14 Jul 2011 02:55:07 -0400 Received: from DualCore (dsdf-4db52e8d.pool.mediaWays.net [77.181.46.141]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0Le4z6-1RHRbA0vSG-00pwJo; Thu, 14 Jul 2011 08:55:04 +0200 From: "Joachim Schmitz" Date: Thu, 14 Jul 2011 08:54:59 +0200 Message-ID: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0034_01CC4203.B6A8C270" X-Mailer: Microsoft Outlook 14.0 Thread-Index: AcxB8rW04MU+cOFyQ2WBsjnT4rJMLA== Content-Language: de X-Provags-ID: V02:K0:rqUcn0zPOd2FEDlwZvX9s2MEX74kKi34EiwkdBJ0IhO TlbXL0N7Z4Xek0zMhwdowGvMf/0aZwsAZjjVLJaezSnMCj/Dj2 4/Bz47L4UzMQMjnuzv8Dcj/bMc+Jpdsku/WU0XZpoMSilBq3I6 X62EP/iP3TV+Du7sLwAo80MQ+Rq7L+EEnBme6NtcJP1tm3YnBX mDnk0F+4S1e/wbw+M5zZoZn7IFAGH1pjvqdofjpRrY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.1 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) This is a multipart message in MIME format. ------=_NextPart_000_0034_01CC4203.B6A8C270 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi folks coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally and on HP NonStop these don't exist. SA_RESETHAND is used in csplit.c and dd.c SA_RESTART is used in ls.c and timeout.c Bye, Jojo ------=_NextPart_000_0034_01CC4203.B6A8C270 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi folks

 

coreutils-8.12 uses SA_RESETHAND and SA_RESTART = unconditionally and on HP NonStop these don’t = exist.

 

SA_RESETHAND is used in csplit.c and dd.c =

SA_RESTART = is used in ls.c and timeout.c

 

Bye, = Jojo

------=_NextPart_000_0034_01CC4203.B6A8C270-- From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 14 Jul 2011 11:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Joachim Schmitz Cc: 9076@debbugs.gnu.org Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131064262722223 (code B ref 9076); Thu, 14 Jul 2011 11:24:02 +0000 Received: (at 9076) by debbugs.gnu.org; 14 Jul 2011 11:23:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhK19-0005mK-MU for submit@debbugs.gnu.org; Thu, 14 Jul 2011 07:23:47 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QhK14-0005m3-JZ for 9076@debbugs.gnu.org; Thu, 14 Jul 2011 07:23:42 -0400 Received: (qmail 92566 invoked from network); 14 Jul 2011 11:23:32 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 14 Jul 2011 11:23:32 -0000 Message-ID: <4E1ED144.6030607@draigBrady.com> Date: Thu, 14 Jul 2011 12:21:40 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> In-Reply-To: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 14/07/11 07:54, Joachim Schmitz wrote: > Hi folks > > > > coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally and on HP > NonStop these don't exist. Ok we'll need to add the above info to: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/posix-functions/sigaction.texi;hb=HEAD > SA_RESETHAND is used in csplit.c and dd.c > SA_RESTART is used in ls.c and timeout.c Well we can define these to 0 to get the compile to succeed. However can you provide info on how to achieve the behavior of SA_RESETHAND and SA_RESTART on your platform. cheers, Pįdraig. From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: "Joachim Schmitz" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 14 Jul 2011 16:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?'P=C3=A1draig?= Brady' Cc: 9076@debbugs.gnu.org Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131066197418123 (code B ref 9076); Thu, 14 Jul 2011 16:47:02 +0000 Received: (at 9076) by debbugs.gnu.org; 14 Jul 2011 16:46:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhP3F-0004iG-B3 for submit@debbugs.gnu.org; Thu, 14 Jul 2011 12:46:13 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhP3A-0004hs-ML for 9076@debbugs.gnu.org; Thu, 14 Jul 2011 12:46:11 -0400 Received: from DualCore (dsdf-4db52e8d.pool.mediaWays.net [77.181.46.141]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LobEI-1R9Z8F2m3m-00ftP2; Thu, 14 Jul 2011 18:46:01 +0200 From: "Joachim Schmitz" References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1ED144.6030607@draigBrady.com> In-Reply-To: <4E1ED144.6030607@draigBrady.com> Date: Thu, 14 Jul 2011 18:45:57 +0200 Message-ID: <001c01cc4245$81781910$84684b30$@schmitz-digital.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGD+TYH2QRCjE40FS7LIiEFfIKlkADd1MnVlXWnCvA= Content-Language: de X-Provags-ID: V02:K0:s59GIunAzC3I/NmknhDbuhcdXA99kvGacD4dK9ryz1s jKyFhPy1yOe32AgPOBSSSRVfL2mz193/gDepzIVP6SsVJI78EX +WfLOZQq7UkCsLZ4SyUWe3vk2OY5B6ICCOx/XG6CdGraKuWtry M/odHmMb0hnxfk8FRGdi1aSueewDa1Ap8HMXWBOI1T1RW9mNwv 1VKX6NUe4IJsEgVm8EkoH8aw1DIJKNOQf7Nhu1m0h4= X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) I'm afraid I have no idea how or whether HP NonStop implements this functionality. I can point to the manual, Open System Services System = CallsReferenceManual, at: http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c02128682/= c02 128682.pdf Bye, Jojo -----Original Message----- From: P=E1draig Brady [mailto:P@draigBrady.com]=20 Sent: Thursday, July 14, 2011 1:22 PM To: Joachim Schmitz Cc: 9076@debbugs.gnu.org Subject: Re: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally On 14/07/11 07:54, Joachim Schmitz wrote: > Hi folks >=20 > =20 >=20 > coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally and on = > HP NonStop these don't exist. Ok we'll need to add the above info to: http://git.savannah.gnu.org/gitweb/?p=3Dgnulib.git;a=3Dblob;f=3Ddoc/posix= -function s/sigaction.texi;hb=3DHEAD > SA_RESETHAND is used in csplit.c and dd.c SA_RESTART is used in ls.c=20 > and timeout.c Well we can define these to 0 to get the compile to succeed. However can you provide info on how to achieve the behavior of = SA_RESETHAND and SA_RESTART on your platform. cheers, P=E1draig. From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 14 Jul 2011 22:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Joachim Schmitz Cc: 9076@debbugs.gnu.org, Bug-gnulib Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131068279413999 (code B ref 9076); Thu, 14 Jul 2011 22:34:03 +0000 Received: (at 9076) by debbugs.gnu.org; 14 Jul 2011 22:33:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhUT4-0003dk-3f for submit@debbugs.gnu.org; Thu, 14 Jul 2011 18:33:14 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhUT1-0003dV-Ie for 9076@debbugs.gnu.org; Thu, 14 Jul 2011 18:33:12 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 1EFFA39E80F0; Thu, 14 Jul 2011 15:33:06 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RTcpjNzAfwa0; Thu, 14 Jul 2011 15:33:01 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 0AAAE39E80E0; Thu, 14 Jul 2011 15:33:01 -0700 (PDT) Message-ID: <4E1F6E9C.8090408@cs.ucla.edu> Date: Thu, 14 Jul 2011 15:33:00 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> In-Reply-To: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.1 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) [CC'ing bug-gnulib re .] On 07/13/11 23:54, Joachim Schmitz wrote: > coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally and on HP > NonStop these don't exist. Thanks for reporting this. I think coreutils used to be portable to hosts lacking those symbols, and there's a bit of code in dd.c that still assumes the old backward-compatibility stuff: static void interrupt_handler (int sig) { if (! SA_RESETHAND) signal (sig, SIG_DFL); interrupt_signal = sig; } but I guess it got ripped out at some point, under the mistaken assumption that everybody has SA_RESETHAND nowadays. Here's a proposed patch to gnulib to address this porting problem. * lib/signal.in.h (SA_RESETHAND, SA_RESTART): Default to 0. * doc/posix-functions/sigaction.texi (sigaction): Document this, and document NonStop portability issues. See Joachim Schmitz in . diff --git a/doc/posix-functions/sigaction.texi b/doc/posix-functions/sigaction.texi index d03e516..583d112 100644 --- a/doc/posix-functions/sigaction.texi +++ b/doc/posix-functions/sigaction.texi @@ -11,6 +11,11 @@ Portability problems fixed by Gnulib: @item This function is missing on some platforms: mingw. + +@item +Some systems do not define the flag SA_NODEFER. +NonStop does not define the flags SA_RESETHAND and SA_RESTART. +Gnulib defines missing flags to zero, which means they have no effect. @end itemize Portability problems not fixed by Gnulib: @@ -33,8 +38,12 @@ missing on some platforms: mingw. @item +Support for SA_RESETHAND is missing on some platforms: +NonStop. + +@item Support for SA_RESTART is missing on some platforms: -mingw. +mingw, NonStop. @item In spite of having SA_SIGACTION, struct sigaction lacks the diff --git a/lib/signal.in.h b/lib/signal.in.h index 93787f7..6765fa3 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -417,10 +417,16 @@ _GL_WARN_ON_USE (sigaction, "sigaction is unportable - " # endif #endif -/* Some systems don't have SA_NODEFER. */ +/* Some systems don't have flags. They default to 0, i.e., no effect. */ #ifndef SA_NODEFER # define SA_NODEFER 0 #endif +#ifndef SA_RESETHAND +# define SA_RESETHAND 0 +#endif +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif #endif /* _@GUARD_PREFIX@_SIGNAL_H */ From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 15 Jul 2011 00:28:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 9076@debbugs.gnu.org, Joachim Schmitz , Bug-gnulib Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131068964927006 (code B ref 9076); Fri, 15 Jul 2011 00:28:03 +0000 Received: (at 9076) by debbugs.gnu.org; 15 Jul 2011 00:27:29 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhWFb-00071X-Rh for submit@debbugs.gnu.org; Thu, 14 Jul 2011 20:27:28 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QhWFZ-00071K-Ms for 9076@debbugs.gnu.org; Thu, 14 Jul 2011 20:27:26 -0400 Received: (qmail 17449 invoked from network); 15 Jul 2011 00:27:19 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 15 Jul 2011 00:27:19 -0000 Message-ID: <4E1F88F7.70806@draigBrady.com> Date: Fri, 15 Jul 2011 01:25:27 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> In-Reply-To: <4E1F6E9C.8090408@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 14/07/11 23:33, Paul Eggert wrote: > [CC'ing bug-gnulib re .] > > On 07/13/11 23:54, Joachim Schmitz wrote: > >> coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally and on HP >> NonStop these don't exist. > > Thanks for reporting this. I think > coreutils used to be portable to hosts lacking those symbols, > and there's a bit of code in dd.c that still assumes the > old backward-compatibility stuff: > > static void > interrupt_handler (int sig) > { > if (! SA_RESETHAND) > signal (sig, SIG_DFL); > interrupt_signal = sig; > } > > but I guess it got ripped out at some point, under the mistaken > assumption that everybody has SA_RESETHAND nowadays. Here's a proposed patch > to gnulib to address this porting problem. I'm not sure about defining these to 0 in gnulib. That will silently ignore the intent of a program on certain platforms. Wouldn't it be better to fail to compile so that each program then does: #ifndef SA_RESETHAND /* do something else */ #endif cheers, Pįdraig. From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 15 Jul 2011 07:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9076@debbugs.gnu.org, Joachim Schmitz , Bug-gnulib Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.1310716217710 (code B ref 9076); Fri, 15 Jul 2011 07:51:02 +0000 Received: (at 9076) by debbugs.gnu.org; 15 Jul 2011 07:50:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhdA8-0000BN-4W for submit@debbugs.gnu.org; Fri, 15 Jul 2011 03:50:16 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhdA6-0000B9-1O for 9076@debbugs.gnu.org; Fri, 15 Jul 2011 03:50:15 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 8D26539E80F7; Fri, 15 Jul 2011 00:50:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fgL2V2xI4S0F; Fri, 15 Jul 2011 00:50:07 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id D06F939E80F2; Fri, 15 Jul 2011 00:50:07 -0700 (PDT) Message-ID: <4E1FF12F.1000406@cs.ucla.edu> Date: Fri, 15 Jul 2011 00:50:07 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> In-Reply-To: <4E1F88F7.70806@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) On 07/14/11 17:25, P=C3=A1draig Brady wrote: > I'm not sure about defining these to 0 in gnulib. > That will silently ignore the intent of a program on certain platforms. > Wouldn't it be better to fail to compile so that each program then does= : >=20 > #ifndef SA_RESETHAND > /* do something else */ > #endif Well, as a matter of style, I prefer this: if (! SA_RESETHAND) do_something_else (); as that's much more likely to detect bitrot in the "do something else" part. (Of course this is all assuming the application writer knows about platforms where SA_RESETHAND isn't implemented.) On NonStop, if you invoke signal(), it uses the SA_RESETHAND semantics (POSIX allows this). Conversely, if you invoke sigaction(), NonStop always behaves as if SA_RESTART and SA_RESETHAND are zero, i.e., it doesn't support either feature with sigaction. I just now checked coreutils. Two programs use SA_RESETHAND. The first (csplit) is clearly using it incorrectly, and won't work properly on any host that implements SA_RESETHAND according to POSIX. The second (dd) is using the above idiom already, that is, it is assuming SA_RESETHAND is #defined to 0 on hosts that don't support it. (It has some obsolete comments though, that need fixing.) Conversely, the two programs that depend on SA_RESTART will probably misbehave if a signal interrupts a system call on NonStop. I see no easy fix for this, and I expect the gnulib change may be the best we can do. Here are a couple of patches that address the SA_RESETHAND problems mentioned above. They assume the gnulib change. They fix the csplit bug (and also allow it to work on NonStop, assuming the gnulib change). diff --git a/src/csplit.c b/src/csplit.c index 438d888..4a0914e 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -225,6 +225,9 @@ static void interrupt_handler (int sig) { delete_all_files (true); + + signal (sig, SIG_DFL); + /* The signal has been reset to SIG_DFL, but blocked during this handler. Force the default action of this signal once the handler returns and the block is removed. */ @@ -1421,7 +1424,7 @@ main (int argc, char **argv) =20 act.sa_handler =3D interrupt_handler; act.sa_mask =3D caught_signals; - act.sa_flags =3D SA_NODEFER | SA_RESETHAND; + act.sa_flags =3D 0; =20 for (i =3D 0; i < nsigs; i++) if (sigismember (&caught_signals, sig[i])) diff --git a/src/dd.c b/src/dd.c index 45aa9b9..c30c78a 100644 --- a/src/dd.c +++ b/src/dd.c @@ -45,7 +45,7 @@ proper_name ("Stuart Kemp") =20 /* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is - present. SA_NODEFER and SA_RESETHAND are XSI extensions. */ + present. */ #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 # define sigprocmask(How, Set, Oset) /* empty */ @@ -726,9 +726,6 @@ install_signal_handlers (void) =20 if (sigismember (&caught_signals, SIGINT)) { - /* POSIX 1003.1-2001 says SA_RESETHAND implies SA_NODEFER, - but this is not true on Solaris 8 at least. It doesn't - hurt to use SA_NODEFER here, so leave it in. */ act.sa_handler =3D interrupt_handler; act.sa_flags =3D SA_NODEFER | SA_RESETHAND; sigaction (SIGINT, &act, NULL); From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Bruno Haible Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 15 Jul 2011 10:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: bug-gnulib@gnu.org Cc: Joachim Schmitz , 9076@debbugs.gnu.org, Paul Eggert Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131072576214316 (code B ref 9076); Fri, 15 Jul 2011 10:30:03 +0000 Received: (at 9076) by debbugs.gnu.org; 15 Jul 2011 10:29:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhfe1-0003in-Ke for submit@debbugs.gnu.org; Fri, 15 Jul 2011 06:29:22 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.161]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhfdd-0003i1-9e for 9076@debbugs.gnu.org; Fri, 15 Jul 2011 06:29:15 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1310725726; l=307; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=b1G7U6tYp/jmM0smJN9FTyLHCOI=; b=i8bnLF5YOwEkp078pYCQR3kiKcj4mztzfYXnm2u8G/N2t/0w526sswxlsHaN3/JTJtA 9R551hHwOCplPw9fp3MSjE15NYpzU/2XUEhEbZv3tEXHizI/m1SILv4U4LDYVnCDSjsF3 spTq46tspcasSTYL7j6L48N9aqD+tzPIAko= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbfQ44IxORg== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-042-252.pools.arcor-ip.net [88.68.42.252]) by smtp.strato.de (fruni mo60) (RZmta 26.0) with ESMTPA id x05c66n6FARWpq ; Fri, 15 Jul 2011 12:28:46 +0200 (MEST) From: Bruno Haible Date: Fri, 15 Jul 2011 12:28:43 +0200 User-Agent: KMail/1.9.9 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> In-Reply-To: <4E1F6E9C.8090408@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201107151228.45356.bruno@clisp.org> X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Paul Eggert wrote: > --- a/doc/posix-functions/sigaction.texi > +++ b/doc/posix-functions/sigaction.texi A documentation update for the header file, in doc/posix-headers/signal.texi, would also be useful. Bruno -- In memoriam Natalya Estemirova From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 15 Jul 2011 10:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 9076@debbugs.gnu.org, Joachim Schmitz , Bug-gnulib Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131072583714471 (code B ref 9076); Fri, 15 Jul 2011 10:31:01 +0000 Received: (at 9076) by debbugs.gnu.org; 15 Jul 2011 10:30:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhffH-0003lL-V2 for submit@debbugs.gnu.org; Fri, 15 Jul 2011 06:30:36 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QhffF-0003l7-Q2 for 9076@debbugs.gnu.org; Fri, 15 Jul 2011 06:30:34 -0400 Received: (qmail 96813 invoked from network); 15 Jul 2011 10:30:28 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 15 Jul 2011 10:30:28 -0000 Message-ID: <4E201651.2090303@draigBrady.com> Date: Fri, 15 Jul 2011 11:28:33 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> In-Reply-To: <4E1FF12F.1000406@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 15/07/11 08:50, Paul Eggert wrote: > On 07/14/11 17:25, PĆ”draig Brady wrote: >> I'm not sure about defining these to 0 in gnulib. >> That will silently ignore the intent of a program on certain platforms. >> Wouldn't it be better to fail to compile so that each program then does: >> >> #ifndef SA_RESETHAND >> /* do something else */ >> #endif > > Well, as a matter of style, I prefer this: > > if (! SA_RESETHAND) > do_something_else (); > > as that's much more likely to detect bitrot in the "do something else" > part. Absolutely. What I was getting was that it's probably better to leave the following to the app too: #ifndef SA_RESETHAND # define SA_RESETHAND 0 /* Now the app writer knows they need to handle this case */ #endif Otherwise new users of sigaction() or whatever may not be aware of portability issues. They're all documented, but they're too easy to miss there IMHO. > (Of course this is all assuming the application writer knows > about platforms where SA_RESETHAND isn't implemented.) > > On NonStop, if you invoke signal(), it uses the SA_RESETHAND semantics > (POSIX allows this). Conversely, if you invoke sigaction(), NonStop > always behaves as if SA_RESTART and SA_RESETHAND are zero, i.e., it > doesn't support either feature with sigaction. Thanks for checking that. > I just now checked coreutils. Two programs use SA_RESETHAND. The > first (csplit) is clearly using it incorrectly, and won't work > properly on any host that implements SA_RESETHAND according to POSIX. agreed > The second (dd) is using the above idiom already, that is, it is > assuming SA_RESETHAND is #defined to 0 on hosts that don't support it. > (It has some obsolete comments though, that need fixing.) > Conversely, the two programs that depend on SA_RESTART will > probably misbehave if a signal interrupts a system call on > NonStop. I see no easy fix for this, and I expect the gnulib > change may be the best we can do. Again, that gnulib change would only paper over the issue. cheers, PĆ”draig. From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 15 Jul 2011 12:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Joachim Schmitz , 9076@debbugs.gnu.org, Paul Eggert , Bug-gnulib Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.13107345611466 (code B ref 9076); Fri, 15 Jul 2011 12:56:02 +0000 Received: (at 9076) by debbugs.gnu.org; 15 Jul 2011 12:56:01 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhhvx-0000NY-1p for submit@debbugs.gnu.org; Fri, 15 Jul 2011 08:56:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhhvq-0000NE-MO for 9076@debbugs.gnu.org; Fri, 15 Jul 2011 08:55:55 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6FCtbei019893 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Jul 2011 08:55:37 -0400 Received: from [10.3.113.37] (ovpn-113-37.phx2.redhat.com [10.3.113.37]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6FCtanQ021672; Fri, 15 Jul 2011 08:55:36 -0400 Message-ID: <4E2038C7.20808@redhat.com> Date: Fri, 15 Jul 2011 06:55:35 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.11 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> <4E201651.2090303@draigBrady.com> In-Reply-To: <4E201651.2090303@draigBrady.com> X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig77216C8D5F6B5B0D302721FF" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -10.3 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.3 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig77216C8D5F6B5B0D302721FF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/15/2011 04:28 AM, P=C3=A1draig Brady wrote: > On 15/07/11 08:50, Paul Eggert wrote: >> On 07/14/11 17:25, P=C3=A1draig Brady wrote: >>> I'm not sure about defining these to 0 in gnulib. >>> That will silently ignore the intent of a program on certain platform= s. > Absolutely. What I was getting was that it's probably better to leave > the following to the app too: >=20 > #ifndef SA_RESETHAND > # define SA_RESETHAND 0 > /* Now the app writer knows they need to handle this case */ > #endif Can't the gnulib sigaction module be taught to fake SA_RESETHAND, by wrapping the user's signal-handler inside a gnulib shim, where the shim resets signals correctly before calling the user's handler? Granted, it's not trivial, but I think that it is still within the realm of technical possibilities. At which point, SA_RESETHAND would always be non-zero once you use the gnulib . >> On NonStop, if you invoke signal(), it uses the SA_RESETHAND semantics= >> (POSIX allows this). Conversely, if you invoke sigaction(), NonStop >> always behaves as if SA_RESTART and SA_RESETHAND are zero, i.e., it >> doesn't support either feature with sigaction. >=20 > Thanks for checking that. Seems like there's some room for improvement in the gnulib sigaction module then. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig77216C8D5F6B5B0D302721FF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJOIDjHAAoJEKeha0olJ0Nq6h4H/2DFdQ5aQH2XbQabpMTDF5OQ HQ/BaiBzTp68EjP7DHS2oNe7LfD+uNVn4YXVgpXq8GlKGlVpjDLcWuPGkaiRtWL4 HYr41GXeN+bGK6pISBGgUqgmlEBQoacN0jLo51+UyFIpsQrf+Sk0YbzR4niILv9d Us70TWRa9gJ2IHmD6fVHh53gv0uSNewkWUyFPMdVh5AvYYp2xtr0dSP9B5aOdDrw FB7Z3lamLr7kIRD/+s8N5/ShC5UYgQX7MlFCpSe9umKlrdh+6H8Cm5D+iuIncMeJ uMOHj2Uqw3JVSFNGSCTSj7wYtG95LLNleEq+QvltZlc9JfHWrgG0+JJkup4/Z5k= =l2Bx -----END PGP SIGNATURE----- --------------enig77216C8D5F6B5B0D302721FF-- From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 16 Jul 2011 00:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9076@debbugs.gnu.org, Joachim Schmitz , Bug-gnulib Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131077750831245 (code B ref 9076); Sat, 16 Jul 2011 00:52:01 +0000 Received: (at 9076) by debbugs.gnu.org; 16 Jul 2011 00:51:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qht6h-00087u-KF for submit@debbugs.gnu.org; Fri, 15 Jul 2011 20:51:47 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qht6e-00087h-5U for 9076@debbugs.gnu.org; Fri, 15 Jul 2011 20:51:45 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 9119639E80F2; Fri, 15 Jul 2011 17:51:38 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ocvc2lqFCnxP; Fri, 15 Jul 2011 17:51:38 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id EFD2639E80E0; Fri, 15 Jul 2011 17:51:37 -0700 (PDT) Message-ID: <4E20E099.6010804@cs.ucla.edu> Date: Fri, 15 Jul 2011 17:51:37 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> <4E201651.2090303@draigBrady.com> In-Reply-To: <4E201651.2090303@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) On 07/15/11 03:28, P=C3=A1draig Brady wrote: > What I was getting was that it's probably better to leave > the following to the app too: >=20 > #ifndef SA_RESETHAND > # define SA_RESETHAND 0 > /* Now the app writer knows they need to handle this case */ > #endif Yes, you're probably right. I'll send some patches along those lines shortly (but not to bug-gnulib since that's not relevant to these coreutils-specific patches). From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 16 Jul 2011 01:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 9076@debbugs.gnu.org, Joachim Schmitz Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.1310778714654 (code B ref 9076); Sat, 16 Jul 2011 01:12:01 +0000 Received: (at 9076) by debbugs.gnu.org; 16 Jul 2011 01:11:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhtQ9-0000AU-4I for submit@debbugs.gnu.org; Fri, 15 Jul 2011 21:11:53 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhtQ7-0000AI-2H for 9076@debbugs.gnu.org; Fri, 15 Jul 2011 21:11:52 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 847EB39E80F2; Fri, 15 Jul 2011 18:11:45 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 258SoCYVFJo9; Fri, 15 Jul 2011 18:11:44 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3163B39E80E0; Fri, 15 Jul 2011 18:11:44 -0700 (PDT) Message-ID: <4E20E54F.5060204@cs.ucla.edu> Date: Fri, 15 Jul 2011 18:11:43 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> <4E201651.2090303@draigBrady.com> In-Reply-To: <4E201651.2090303@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) Here are three proposed patches to coreutils to address the SA_RESETHAND and SA_RESTART issues. I hope that if you combine them with the patch I already installed: http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=837e1f55196f826b92d660808f594fde36651655 these should fix all the issues mentioned here. Joachim, could you please try these? Thanks. >From bbd4c9edfa4bd5650106261b7d9b1dd434d91581 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2011 17:38:32 -0700 Subject: [PATCH 1/3] dd: port to NonStop (Bug#9076) * src/dd.c (SA_RESETHAND): Define to 0 if not defined. --- src/dd.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/dd.c b/src/dd.c index 3e75412..0824f6c 100644 --- a/src/dd.c +++ b/src/dd.c @@ -55,6 +55,11 @@ # endif #endif +/* NonStop circa 2011 lacks SA_RESETHAND; see Bug#9076. */ +#ifndef SA_RESETHAND +# define SA_RESETHAND 0 +#endif + #ifndef SIGINFO # define SIGINFO SIGUSR1 #endif -- 1.7.4.4 >From 995299ff155bef70a3b153dc8cef11ed9b1d8904 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2011 17:39:28 -0700 Subject: [PATCH 2/3] ls: port to NonStop (Bug#9076) * src/ls.c (SA_RESTART): Define to 0 if not defined. --- src/ls.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/ls.c b/src/ls.c index c604e14..680a7c3 100644 --- a/src/ls.c +++ b/src/ls.c @@ -74,6 +74,14 @@ # endif #endif +/* NonStop circa 2011 lacks both SA_RESTART and siginterrupt, so don't + restart syscalls after a signal handler fires. This may cause + colors to get messed up on the screen if 'ls' is interrupted, but + that's the best we can do on such a platform. */ +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif + #include "system.h" #include -- 1.7.4.4 >From 638e670d76b3bf573f6a9930b376811b5663881a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2011 17:48:38 -0700 Subject: [PATCH 3/3] timeout: port to NonStop (Bug#9077) * src/timeout.c (SA_RESTART): Define to 0 if not defined. (main): Don't assume signal handling uses SA_RESTART. --- src/timeout.c | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/timeout.c b/src/timeout.c index ef660a7..895d720 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -64,6 +64,11 @@ # include #endif +/* NonStop circa 2011 lacks both SA_RESTART and siginterrupt. */ +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif + #define PROGRAM_NAME "timeout" #define AUTHORS proper_name_utf8 ("Padraig Brady", "P\303\241draig Brady") @@ -256,7 +261,8 @@ install_signal_handlers (int sigterm) struct sigaction sa; sigemptyset (&sa.sa_mask); /* Allow concurrent calls to handler */ sa.sa_handler = cleanup; - sa.sa_flags = SA_RESTART; /* restart syscalls (like wait() below) */ + sa.sa_flags = SA_RESTART; /* Restart syscalls if possible, as that's + more likely to work cleanly. */ sigaction (SIGALRM, &sa, NULL); /* our timeout. */ sigaction (SIGINT, &sa, NULL); /* Ctrl-C at terminal for example. */ @@ -354,18 +360,15 @@ main (int argc, char **argv) } else { + pid_t wait_result; int status; alarm (timeout); - /* We're just waiting for a single process here, so wait() suffices. - Note the signal() calls above on GNU/Linux and BSD at least, - essentially call the lower level sigaction() with the SA_RESTART flag - set, which ensures the following wait call will only return if the - child exits, not on this process receiving a signal. Also we're not - passing WUNTRACED | WCONTINUED to a waitpid() call and so will not get - indication that the child has stopped or continued. */ - if (wait (&status) == -1) + while ((wait_result = wait (&status)) < 0 && errno == EINTR) + continue; + + if (wait_result < 0) { /* shouldn't happen. */ error (0, errno, _("error waiting for command")); -- 1.7.4.4 From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Bastien ROUCARIES Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 16 Jul 2011 08:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: Bug-gnulib , 9076@debbugs.gnu.org, Joachim Schmitz , =?UTF-8?Q?P=C3=A1draig?= Brady , Paul Eggert Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.13108055156073 (code B ref 9076); Sat, 16 Jul 2011 08:39:02 +0000 Received: (at 9076) by debbugs.gnu.org; 16 Jul 2011 08:38:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi0OP-0001Zs-Ke for submit@debbugs.gnu.org; Sat, 16 Jul 2011 04:38:34 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi0OM-0001ZZ-Dk for 9076@debbugs.gnu.org; Sat, 16 Jul 2011 04:38:31 -0400 Received: by wwf25 with SMTP id 25so1842723wwf.15 for <9076@debbugs.gnu.org>; Sat, 16 Jul 2011 01:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=xsfH8+5f7Gu+udsPVJHjiJpd+DXJec2R+thg6zBYKvo=; b=Jjk6unNZD76lTjUSyJRfXK1DYrxn9ypXYpZDeRuG9Sf5kWHFxuyRqlprt6L1A25hRV 6U6T2vgzn176lxBdHKicvm83+Pi4sxN+uy0GniHXU96PhiNsLPDH9ElFD+5yQGlc4Ul5 /2Q8eAC+9+gGSAMq4bZSWcZnzHGIiRe+KOeTc= MIME-Version: 1.0 Received: by 10.227.32.138 with SMTP id c10mr3807243wbd.79.1310805504256; Sat, 16 Jul 2011 01:38:24 -0700 (PDT) Received: by 10.227.30.88 with HTTP; Sat, 16 Jul 2011 01:38:24 -0700 (PDT) In-Reply-To: <4E2038C7.20808@redhat.com> References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> <4E201651.2090303@draigBrady.com> <4E2038C7.20808@redhat.com> Date: Sat, 16 Jul 2011 10:38:24 +0200 Message-ID: From: Bastien ROUCARIES Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.6 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) 2011/7/15 Eric Blake : > On 07/15/2011 04:28 AM, P=C3=A1draig Brady wrote: >> On 15/07/11 08:50, Paul Eggert wrote: >>> On 07/14/11 17:25, P=C3=A1draig Brady wrote: >>>> I'm not sure about defining these to 0 in gnulib. >>>> That will silently ignore the intent of a program on certain platforms= . > >> Absolutely. What I was getting was that it's probably better to leave >> the following to the app too: >> >> #ifndef SA_RESETHAND >> # define SA_RESETHAND 0 >> /* Now the app writer knows they need to handle this case */ >> #endif > > Can't the gnulib sigaction module be taught to fake SA_RESETHAND, by > wrapping the user's signal-handler inside a gnulib shim, where the shim > resets signals correctly before calling the user's handler? =C2=A0Granted= , > it's not trivial, but I think that it is still within the realm of > technical possibilities. =C2=A0At which point, SA_RESETHAND would always = be > non-zero once you use the gnulib . > >>> On NonStop, if you invoke signal(), it uses the SA_RESETHAND semantics >>> (POSIX allows this). =C2=A0Conversely, if you invoke sigaction(), NonSt= op >>> always behaves as if SA_RESTART and SA_RESETHAND are zero, i.e., it >>> doesn't support either feature with sigaction. >> >> Thanks for checking that. > > Seems like there's some room for improvement in the gnulib sigaction > module then. Could help to implement pipe to self for pselect... I favor this. Bastien From unknown Mon Aug 18 14:23:08 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Joachim Schmitz" Subject: bug#9076: closed (Re: bug#9098: timeout should use waitpid) Message-ID: References: <4E21E41C.4050202@cs.ucla.edu> <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> X-Gnu-PR-Message: they-closed 9076 X-Gnu-PR-Package: coreutils Reply-To: 9076@debbugs.gnu.org Date: Sat, 16 Jul 2011 19:20:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1310844004-17815-1" This is a multi-part message in MIME format... ------------=_1310844004-17815-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 9076@debbugs.gnu.org. --=20 9076: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D9076 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1310844004-17815-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 9076-done) by debbugs.gnu.org; 16 Jul 2011 19:19:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QiAOO-0004c8-Hs for submit@debbugs.gnu.org; Sat, 16 Jul 2011 15:19:13 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QiAOK-0004br-QT; Sat, 16 Jul 2011 15:19:10 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id C45D539E80F2; Sat, 16 Jul 2011 12:19:02 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LRGWR19PnSJb; Sat, 16 Jul 2011 12:19:01 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 8011939E80E1; Sat, 16 Jul 2011 12:19:01 -0700 (PDT) Message-ID: <4E21E41C.4050202@cs.ucla.edu> Date: Sat, 16 Jul 2011 12:18:52 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: Andreas Schwab Subject: Re: bug#9098: timeout should use waitpid References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 9076-done Cc: 9098-done@debbugs.gnu.org, =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= , 9076-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) Thanks for reporting that. I merged that into some other timeout stuff I was already looking at, and pushed the following set of patches. They also should fix Bug#9076, so I'm CC'ing that and marking both bugs "done". I have a couple of other ideas for improving "timeout" but figure they could use some review so I'll post them as separate bug reports. >From bbd4c9edfa4bd5650106261b7d9b1dd434d91581 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2011 17:38:32 -0700 Subject: [PATCH 1/6] dd: port to NonStop (Bug#9076) * src/dd.c (SA_RESETHAND): Define to 0 if not defined. --- src/dd.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/dd.c b/src/dd.c index 3e75412..0824f6c 100644 --- a/src/dd.c +++ b/src/dd.c @@ -55,6 +55,11 @@ # endif #endif +/* NonStop circa 2011 lacks SA_RESETHAND; see Bug#9076. */ +#ifndef SA_RESETHAND +# define SA_RESETHAND 0 +#endif + #ifndef SIGINFO # define SIGINFO SIGUSR1 #endif -- 1.7.4.4 >From 995299ff155bef70a3b153dc8cef11ed9b1d8904 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2011 17:39:28 -0700 Subject: [PATCH 2/6] ls: port to NonStop (Bug#9076) * src/ls.c (SA_RESTART): Define to 0 if not defined. --- src/ls.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/ls.c b/src/ls.c index c604e14..680a7c3 100644 --- a/src/ls.c +++ b/src/ls.c @@ -74,6 +74,14 @@ # endif #endif +/* NonStop circa 2011 lacks both SA_RESTART and siginterrupt, so don't + restart syscalls after a signal handler fires. This may cause + colors to get messed up on the screen if 'ls' is interrupted, but + that's the best we can do on such a platform. */ +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif + #include "system.h" #include -- 1.7.4.4 >From 638e670d76b3bf573f6a9930b376811b5663881a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2011 17:48:38 -0700 Subject: [PATCH 3/6] timeout: port to NonStop (Bug#9077) * src/timeout.c (SA_RESTART): Define to 0 if not defined. (main): Don't assume signal handling uses SA_RESTART. --- src/timeout.c | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/timeout.c b/src/timeout.c index ef660a7..895d720 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -64,6 +64,11 @@ # include #endif +/* NonStop circa 2011 lacks both SA_RESTART and siginterrupt. */ +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif + #define PROGRAM_NAME "timeout" #define AUTHORS proper_name_utf8 ("Padraig Brady", "P\303\241draig Brady") @@ -256,7 +261,8 @@ install_signal_handlers (int sigterm) struct sigaction sa; sigemptyset (&sa.sa_mask); /* Allow concurrent calls to handler */ sa.sa_handler = cleanup; - sa.sa_flags = SA_RESTART; /* restart syscalls (like wait() below) */ + sa.sa_flags = SA_RESTART; /* Restart syscalls if possible, as that's + more likely to work cleanly. */ sigaction (SIGALRM, &sa, NULL); /* our timeout. */ sigaction (SIGINT, &sa, NULL); /* Ctrl-C at terminal for example. */ @@ -354,18 +360,15 @@ main (int argc, char **argv) } else { + pid_t wait_result; int status; alarm (timeout); - /* We're just waiting for a single process here, so wait() suffices. - Note the signal() calls above on GNU/Linux and BSD at least, - essentially call the lower level sigaction() with the SA_RESTART flag - set, which ensures the following wait call will only return if the - child exits, not on this process receiving a signal. Also we're not - passing WUNTRACED | WCONTINUED to a waitpid() call and so will not get - indication that the child has stopped or continued. */ - if (wait (&status) == -1) + while ((wait_result = wait (&status)) < 0 && errno == EINTR) + continue; + + if (wait_result < 0) { /* shouldn't happen. */ error (0, errno, _("error waiting for command")); -- 1.7.4.4 >From 1f97794a3acfad6d169c60adec5a7ce916baa8f9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Jul 2011 05:57:19 -0700 Subject: [PATCH 4/6] * src/timeout.c (main): Use waitpid, not wait (Bug#9098). Reported by Andreas Schwab. * src/timeout.c (SA_RESTART): Define to 0 if not defined. --- src/timeout.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/timeout.c b/src/timeout.c index 895d720..2d6dad8 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -365,7 +365,8 @@ main (int argc, char **argv) alarm (timeout); - while ((wait_result = wait (&status)) < 0 && errno == EINTR) + while ((wait_result = waitpid (monitored_pid, &status, 0)) < 0 + && errno == EINTR) continue; if (wait_result < 0) -- 1.7.4.4 >From 22e9697c795148548410673260595745d4e8d764 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Jul 2011 06:03:47 -0700 Subject: [PATCH 5/6] Fix capiTalization in comments. --- src/timeout.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/timeout.c b/src/timeout.c index 2d6dad8..33bb8e4 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -35,7 +35,7 @@ This can be seen with `timeout 10 dd&` for example. However if one brings this group to the foreground with the `fg` command before the timer expires, the command will remain - in the sTop state as the shell doesn't send a SIGCONT + in the stop state as the shell doesn't send a SIGCONT because the timeout process (group leader) is already running. To get the command running again one can Ctrl-Z, and do fg again. Note one can Ctrl-C the whole job when in this state. @@ -333,9 +333,9 @@ main (int argc, char **argv) /* Setup handlers before fork() so that we handle any signals caused by child, without races. */ install_signal_handlers (term_signal); - signal (SIGTTIN, SIG_IGN); /* don't sTop if background child needs tty. */ - signal (SIGTTOU, SIG_IGN); /* don't sTop if background child needs tty. */ - signal (SIGCHLD, SIG_DFL); /* Don't inherit CHLD handling from parent. */ + signal (SIGTTIN, SIG_IGN); /* Don't stop if background child needs tty. */ + signal (SIGTTOU, SIG_IGN); /* Don't stop if background child needs tty. */ + signal (SIGCHLD, SIG_DFL); /* Don't inherit CHLD handling from parent. */ monitored_pid = fork (); if (monitored_pid == -1) -- 1.7.4.4 >From f9bcef4765dc7c3ecb8d7c58ae410087195e6fb1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Jul 2011 12:07:46 -0700 Subject: [PATCH 6/6] timeout: treat seconds counts like 'sleep' does Treat fractions as a request to round up to the next representable value, and treat out-of-range values as maximal ones. This is consistent with how "sleep" works. And this way, "timeout 999999999999999999d FOO" and "timeout 4.5 foo" are more likely to do what the user wants. * src/timeout.c: Include c-strtod.h and xstrtod.h, not xstrtol.h. (apply_time_suffix): Change it to the way sleep.c's time_suffix does things. Maybe this function (identical in both programs, other than its name) should be moved to a library? (parse_duration): Return a maximal value on overflow. Return unsigned int, not unsigned long. Allow fractions, which round up to the next integer value. * tests/misc/timeout-parameters: Adjust tests to match new behavior. Add a very large number. --- src/timeout.c | 60 ++++++++++++++++++++++++----------------- tests/misc/timeout-parameters | 16 +++++++++- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/timeout.c b/src/timeout.c index 33bb8e4..ccb4f85 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -52,7 +52,8 @@ #include #include "system.h" -#include "xstrtol.h" +#include "c-strtod.h" +#include "xstrtod.h" #include "sig2str.h" #include "operand2sig.h" #include "error.h" @@ -196,54 +197,51 @@ use the KILL (9) signal, since this signal cannot be caught.\n"), stdout); exit (status); } -/* Given a long integer value *X, and a suffix character, SUFFIX_CHAR, +/* Given a floating point value *X, and a suffix character, SUFFIX_CHAR, scale *X by the multiplier implied by SUFFIX_CHAR. SUFFIX_CHAR may be the NUL byte or `s' to denote seconds, `m' for minutes, `h' for hours, or `d' for days. If SUFFIX_CHAR is invalid, don't modify *X - and return false. If *X would overflow an integer, don't modify *X - and return false. Otherwise return true. */ + and return false. Otherwise return true. */ static bool -apply_time_suffix (unsigned long *x, char suffix_char) +apply_time_suffix (double *x, char suffix_char) { - unsigned int multiplier = 1; + int multiplier; switch (suffix_char) { case 0: case 's': - return true; - case 'd': - multiplier *= 24; - case 'h': - multiplier *= 60; + multiplier = 1; + break; case 'm': - if (multiplier > UINT_MAX / 60) /* 16 bit overflow */ - return false; - multiplier *= 60; + multiplier = 60; + break; + case 'h': + multiplier = 60 * 60; + break; + case 'd': + multiplier = 60 * 60 * 24; break; default: return false; } - if (*x > UINT_MAX / multiplier) - return false; - *x *= multiplier; return true; } -static unsigned long +static unsigned int parse_duration (const char* str) { - unsigned long duration; - char *ep; + double duration; + const char *ep; - if (xstrtoul (str, &ep, 10, &duration, NULL) - /* Invalid interval. Note 0 disables timeout */ - || (duration > UINT_MAX) - /* Extra chars after the number and an optional s,m,h,d char. */ + if (!xstrtod (str, &ep, &duration, c_strtod) + /* Nonnegative interval. */ + || ! (0 <= duration) + /* No extra chars after the number and an optional s,m,h,d char. */ || (*ep && *(ep + 1)) /* Check any suffix char and update timeout based on the suffix. */ || !apply_time_suffix (&duration, *ep)) @@ -252,7 +250,19 @@ parse_duration (const char* str) usage (EXIT_CANCELED); } - return duration; + /* Return the requested duration, rounded up to the next representable value. + Treat out-of-range values as if they were maximal, + as that's more useful in practice than reporting an error. + + FIXME: Use dtotimespec + setitimer if setitimer is available, + as that has higher resolution. */ + if (UINT_MAX <= duration) + return UINT_MAX; + else + { + unsigned int duration_floor = duration; + return duration_floor + (duration_floor < duration); + } } static void diff --git a/tests/misc/timeout-parameters b/tests/misc/timeout-parameters index 6e9152b..56804a8 100755 --- a/tests/misc/timeout-parameters +++ b/tests/misc/timeout-parameters @@ -37,11 +37,23 @@ test $? = 125 || fail=1 # timeout overflow timeout $UINT_OFLOW sleep 0 -test $? = 125 || fail=1 +test $? = 0 || fail=1 # timeout overflow timeout $(expr $UINT_MAX / 86400 + 1)d sleep 0 -test $? = 125 || fail=1 +test $? = 0 || fail=1 + +# timeout overflow +timeout 999999999999999999999999999999999999999999999999999999999999d sleep 0 +test $? = 0 || fail=1 + +# floating point notation +timeout 2.34 sleep 0 +test $? = 0 || fail=1 + +# floating point notation +timeout 2.34e+5d sleep 0 +test $? = 0 || fail=1 # invalid signal spec timeout --signal=invalid 1 sleep 0 -- 1.7.4.4 ------------=_1310844004-17815-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Jul 2011 06:55:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhFpR-0008D3-PW for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhFpP-0008Cp-Bg for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhFpI-0008Fi-Dx for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:47124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhFpI-0008Fe-5P for submit@debbugs.gnu.org; Thu, 14 Jul 2011 02:55:12 -0400 Received: from eggs.gnu.org ([140.186.70.92]:46446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhFpG-0007kS-HN for bug-coreutils@gnu.org; Thu, 14 Jul 2011 02:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhFpD-0008DH-US for bug-coreutils@gnu.org; Thu, 14 Jul 2011 02:55:10 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:52347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhFpD-0008B8-B2 for bug-coreutils@gnu.org; Thu, 14 Jul 2011 02:55:07 -0400 Received: from DualCore (dsdf-4db52e8d.pool.mediaWays.net [77.181.46.141]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0Le4z6-1RHRbA0vSG-00pwJo; Thu, 14 Jul 2011 08:55:04 +0200 From: "Joachim Schmitz" To: Subject: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Date: Thu, 14 Jul 2011 08:54:59 +0200 Message-ID: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0034_01CC4203.B6A8C270" X-Mailer: Microsoft Outlook 14.0 Thread-Index: AcxB8rW04MU+cOFyQ2WBsjnT4rJMLA== Content-Language: de X-Provags-ID: V02:K0:rqUcn0zPOd2FEDlwZvX9s2MEX74kKi34EiwkdBJ0IhO TlbXL0N7Z4Xek0zMhwdowGvMf/0aZwsAZjjVLJaezSnMCj/Dj2 4/Bz47L4UzMQMjnuzv8Dcj/bMc+Jpdsku/WU0XZpoMSilBq3I6 X62EP/iP3TV+Du7sLwAo80MQ+Rq7L+EEnBme6NtcJP1tm3YnBX mDnk0F+4S1e/wbw+M5zZoZn7IFAGH1pjvqdofjpRrY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) This is a multipart message in MIME format. ------=_NextPart_000_0034_01CC4203.B6A8C270 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi folks coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally and on HP NonStop these don't exist. SA_RESETHAND is used in csplit.c and dd.c SA_RESTART is used in ls.c and timeout.c Bye, Jojo ------=_NextPart_000_0034_01CC4203.B6A8C270 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi folks

 

coreutils-8.12 uses SA_RESETHAND and SA_RESTART = unconditionally and on HP NonStop these don’t = exist.

 

SA_RESETHAND is used in csplit.c and dd.c =

SA_RESTART = is used in ls.c and timeout.c

 

Bye, = Jojo

------=_NextPart_000_0034_01CC4203.B6A8C270-- ------------=_1310844004-17815-1-- From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: bug#9098: timeout should use waitpid Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 17 Jul 2011 09:45:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 9076@debbugs.gnu.org Cc: eggert@cs.ucla.edu Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131089587216802 (code B ref 9076); Sun, 17 Jul 2011 09:45:03 +0000 Received: (at 9076) by debbugs.gnu.org; 17 Jul 2011 09:44:32 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QiNtn-0004Mx-KM for submit@debbugs.gnu.org; Sun, 17 Jul 2011 05:44:32 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QiNtl-0004Ml-BI for 9076@debbugs.gnu.org; Sun, 17 Jul 2011 05:44:30 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id A5A1763C97; Sun, 17 Jul 2011 11:44:23 +0200 (CEST) From: Jim Meyering In-Reply-To: <4E21E41C.4050202@cs.ucla.edu> (Paul Eggert's message of "Sat, 16 Jul 2011 12:18:52 -0700") References: <4E21E41C.4050202@cs.ucla.edu> Date: Sun, 17 Jul 2011 11:44:23 +0200 Message-ID: <871uxpqm14.fsf@rho.meyering.net> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.1 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) Paul Eggert wrote: ... > Subject: [PATCH 4/6] * src/timeout.c (main): Use waitpid, not wait > (Bug#9098). > > Reported by Andreas Schwab. > > * src/timeout.c (SA_RESTART): Define to 0 if not defined. > --- > src/timeout.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/src/timeout.c b/src/timeout.c > index 895d720..2d6dad8 100644 > --- a/src/timeout.c > +++ b/src/timeout.c > @@ -365,7 +365,8 @@ main (int argc, char **argv) > > alarm (timeout); > > - while ((wait_result = wait (&status)) < 0 && errno == EINTR) > + while ((wait_result = waitpid (monitored_pid, &status, 0)) < 0 > + && errno == EINTR) Thanks for doing that. Since this fixes a bug, would you please add a note to NEWS and add a test case to exercise the bug? From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: bug#9098: timeout should use waitpid Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 17 Jul 2011 19:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Jim Meyering Cc: 9076@debbugs.gnu.org Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131093247015141 (code B ref 9076); Sun, 17 Jul 2011 19:55:02 +0000 Received: (at 9076) by debbugs.gnu.org; 17 Jul 2011 19:54:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QiXQ5-0003wA-Af for submit@debbugs.gnu.org; Sun, 17 Jul 2011 15:54:29 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QiXQ2-0003vq-Iv for 9076@debbugs.gnu.org; Sun, 17 Jul 2011 15:54:27 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 8B8DA39E80F2; Sun, 17 Jul 2011 12:54:20 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Hn7nqaPmjGW; Sun, 17 Jul 2011 12:54:20 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id DA14939E80E1; Sun, 17 Jul 2011 12:54:19 -0700 (PDT) Message-ID: <4E233DEB.9030404@cs.ucla.edu> Date: Sun, 17 Jul 2011 12:54:19 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 References: <4E21E41C.4050202@cs.ucla.edu> <871uxpqm14.fsf@rho.meyering.net> In-Reply-To: <871uxpqm14.fsf@rho.meyering.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) On 07/17/11 02:44, Jim Meyering wrote: > would you please add a note to NEWS and > add a test case to exercise the bug? Sure, done as follows: >From fb266dea471f442ecd09813d3e009242135aa1ab Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 17 Jul 2011 12:47:22 -0700 Subject: [PATCH 1/2] timeout: add regression test (Bug#9098) * tests/misc/timeout: Check that 'timeout' is not confused when starting off with a child. --- tests/misc/timeout | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/tests/misc/timeout b/tests/misc/timeout index 7506e7c..04465e1 100755 --- a/tests/misc/timeout +++ b/tests/misc/timeout @@ -51,4 +51,9 @@ test $? = 124 && fail=1 exec timeout 10 true ) || fail=1 +# Don't be confused when starting off with a child (Bug#9098). +out=$(sleep 1 & exec timeout 2 sh -c 'sleep 3; echo foo') +status=$? +test "$out" = "" && test $status = 124 || fail=1 + Exit $fail -- 1.7.4.4 >From 5cda9009fc68485b1bd04a845e68c103170f6be8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 17 Jul 2011 12:51:56 -0700 Subject: [PATCH 2/2] * NEWS: Mention fix for Bug#9098. --- NEWS | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS index c382200..61e6e63 100644 --- a/NEWS +++ b/NEWS @@ -15,7 +15,8 @@ GNU coreutils NEWS -*- outline -*- [bug introduced in coreutils-8.8] timeout now sends signals to commands that create their own process group. - [bug introduced in coreutils-7.0] + timeout is no longer confused when starting off with a child process. + [bugs introduced in coreutils-7.0] ** Changes in behavior -- 1.7.4.4 From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: "Joachim Schmitz" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 19 Jul 2011 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: "'Paul Eggert'" , =?UTF-8?Q?'P=C3=A1draig?= Brady' Cc: 9076@debbugs.gnu.org Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.13110922615299 (code B ref 9076); Tue, 19 Jul 2011 16:18:02 +0000 Received: (at 9076) by debbugs.gnu.org; 19 Jul 2011 16:17:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QjCzJ-0001NM-84 for submit@debbugs.gnu.org; Tue, 19 Jul 2011 12:17:41 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QjCzD-0001N2-9m for 9076@debbugs.gnu.org; Tue, 19 Jul 2011 12:17:35 -0400 Received: from DualCore (dsdf-4d0a082b.pool.mediaWays.net [77.10.8.43]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0M2YjJ-1RYYic1uez-00sKSZ; Tue, 19 Jul 2011 18:17:24 +0200 From: "Joachim Schmitz" References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> <4E201651.2090303@draigBrady.com> <4E20E54F.5060204@cs.ucla.edu> In-Reply-To: <4E20E54F.5060204@cs.ucla.edu> Date: Tue, 19 Jul 2011 18:17:21 +0200 Message-ID: <001f01cc462f$57c30e70$07492b50$@schmitz-digital.de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGD+TYH2QRCjE40FS7LIiEFfIKlkAHYrro2AWX5LzsBvSmeTAKE71hQAoanUp+VNDBNIA== Content-Language: de X-Provags-ID: V02:K0:NQqM5AuGRTzraj7whVPgicXFoC2WWgnbDUQ7x6vIYH2 zIRI7dGk3Irq/xPvC6mPY+Dz8/WnSMze5Iamq3FhnqbPgu47yN qimt6sujP97j6ZdYLVDnEu6voy53ECCef9PfVRU4BM8cxtwfzw L2wZAZ8dUzW7pDwqDohopPyH1M814kqGtchDbKBznShcsqIG7v ZmNExQmi7G2swfoD6JBoxjqQibmfHqmY2hPtL9vTfI= X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > -----Original Message----- > From: Paul Eggert [mailto:eggert@cs.ucla.edu] > Sent: Saturday, July 16, 2011 3:12 AM Sorry for the delay, got distracted with $DAYJOB > To: P=C3=A1draig Brady > Cc: Joachim Schmitz; 9076@debbugs.gnu.org > Subject: Re: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART > unconditionally >=20 > Here are three proposed patches to coreutils to address the = SA_RESETHAND > and SA_RESTART issues. I hope that if you combine them with the patch = I > already installed: >=20 > = http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=3D837e1f55196f8= 26b92 > d660808f594fde36651655 >=20 > these should fix all the issues mentioned here. > Joachim, could you please try these? Thanks. Yes they work for me, thanks! Bye, Jojo From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 20 Jul 2011 10:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert , Eric Blake Cc: 9076@debbugs.gnu.org, Joachim Schmitz , Bug-gnulib Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131115678627395 (code B ref 9076); Wed, 20 Jul 2011 10:14:02 +0000 Received: (at 9076) by debbugs.gnu.org; 20 Jul 2011 10:13:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QjTm1-00077k-NB for submit@debbugs.gnu.org; Wed, 20 Jul 2011 06:13:06 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QjTlu-00077C-OS for 9076@debbugs.gnu.org; Wed, 20 Jul 2011 06:12:59 -0400 Received: (qmail 22452 invoked from network); 20 Jul 2011 10:12:48 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 20 Jul 2011 10:12:48 -0000 Message-ID: <4E26A996.2000009@draigBrady.com> Date: Wed, 20 Jul 2011 11:10:30 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> <4E201651.2090303@draigBrady.com> <4E20E099.6010804@cs.ucla.edu> In-Reply-To: <4E20E099.6010804@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 16/07/11 01:51, Paul Eggert wrote: > On 07/15/11 03:28, PƔdraig Brady wrote: >> What I was getting was that it's probably better to leave >> the following to the app too: >> >> #ifndef SA_RESETHAND >> # define SA_RESETHAND 0 >> /* Now the app writer knows they need to handle this case */ >> #endif > > Yes, you're probably right. I'll send some patches along > those lines shortly (but not to bug-gnulib since that's not > relevant to these coreutils-specific patches). I notice that make syntax-check is now failing in coreutils. src/dd.c:# define SA_RESETHAND 0 src/ls.c:# define SA_RESTART 0 src/timeout.c:# define SA_RESTART 0 maint.mk: define the above via some gnulib .h file make: *** [sc_prohibit_always-defined_macros] Error 1 This is because those are defined in signal.h.in which were added as part of cfb3906f to add sigaction support to mingw. Eric do you think we should define those in gnulib? My thinking was that the onus should be on the apps to #define these, as otherwise it's too easy for compiles to just proceed on a platform while ignoring requested operations. cheers, PƔdraig. From unknown Mon Aug 18 14:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 27 Jul 2011 16:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9076 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: Bug-gnulib , Joachim Schmitz , 9076@debbugs.gnu.org, Paul Eggert , Eric Blake Received: via spool by 9076-submit@debbugs.gnu.org id=B9076.131178539814232 (code B ref 9076); Wed, 27 Jul 2011 16:50:02 +0000 Received: (at 9076) by debbugs.gnu.org; 27 Jul 2011 16:49:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qm7Iz-0003hU-MS for submit@debbugs.gnu.org; Wed, 27 Jul 2011 12:49:58 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qm7Ix-0003hN-4u for 9076@debbugs.gnu.org; Wed, 27 Jul 2011 12:49:56 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 0B9E160092; Wed, 27 Jul 2011 18:49:54 +0200 (CEST) From: Jim Meyering In-Reply-To: <4E26A996.2000009@draigBrady.com> ("=?UTF-8?Q?P=C3=A1draig?= Brady"'s message of "Wed, 20 Jul 2011 11:10:30 +0100") References: <003301cc41f2$f31d8170$d9588450$@schmitz-digital.de> <4E1F6E9C.8090408@cs.ucla.edu> <4E1F88F7.70806@draigBrady.com> <4E1FF12F.1000406@cs.ucla.edu> <4E201651.2090303@draigBrady.com> <4E20E099.6010804@cs.ucla.edu> <4E26A996.2000009@draigBrady.com> Date: Wed, 27 Jul 2011 18:49:53 +0200 Message-ID: <87k4b3vfbi.fsf@rho.meyering.net> Lines: 48 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -6.1 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) P=E1draig Brady wrote: > On 16/07/11 01:51, Paul Eggert wrote: >> On 07/15/11 03:28, P=E1draig Brady wrote: >>> What I was getting was that it's probably better to leave >>> the following to the app too: >>> >>> #ifndef SA_RESETHAND >>> # define SA_RESETHAND 0 >>> /* Now the app writer knows they need to handle this case */ >>> #endif >> >> Yes, you're probably right. I'll send some patches along >> those lines shortly (but not to bug-gnulib since that's not >> relevant to these coreutils-specific patches). > > I notice that make syntax-check is now failing in coreutils. > > src/dd.c:# define SA_RESETHAND 0 > src/ls.c:# define SA_RESTART 0 > src/timeout.c:# define SA_RESTART 0 > maint.mk: define the above via some gnulib .h file > make: *** [sc_prohibit_always-defined_macros] Error 1 > > This is because those are defined in signal.h.in which were > added as part of cfb3906f to add sigaction support to mingw. > > Eric do you think we should define those in gnulib? > My thinking was that the onus should be on the apps > to #define these, as otherwise it's too easy for > compiles to just proceed on a platform while ignoring > requested operations. Either way it's not a big deal, but I want coreutils' "make syntax-check" test to pass once again, so I'll probably push this to gnulib later today and update coreutils to use it: diff --git a/top/maint.mk b/top/maint.mk index 9357728..6c1bf44 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -753,6 +753,7 @@ gl_extract_significant_defines_ =3D \ /^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\ && $$2 !~ /(?:rpl_|_used_without_)/\ && $$1 !~ /^(?:NSIG)$$/\ + && $$1 !~ /^(?:SA_RESETHAND|SA_RESTART)$$/\ and print $$1 # Create a list of regular expressions matching the names