From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: ls --color cannot be interrupted by a signal Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 15 Aug 2016 13:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 24232@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147126932118752 (code B ref -1); Mon, 15 Aug 2016 13:56:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Aug 2016 13:55:21 +0000 Received: from localhost ([127.0.0.1]:58392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZIMK-0004sO-UW for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZIMI-0004sI-6O for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZIMC-00038n-22 for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:12 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZIMB-00038D-Vf for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZIM9-0005pq-LA for bug-coreutils@gnu.org; Mon, 15 Aug 2016 09:55:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZIM5-00031m-G2 for bug-coreutils@gnu.org; Mon, 15 Aug 2016 09:55:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZIM5-00031c-AD for bug-coreutils@gnu.org; Mon, 15 Aug 2016 09:55:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C05A2C9DC8 for ; Mon, 15 Aug 2016 13:55:03 +0000 (UTC) Received: from kdudka-nb.localnet (unused-4-106.brq.redhat.com [10.34.4.106]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7FDt1AH028114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 15 Aug 2016 09:55:02 -0400 From: Kamil Dudka Date: Mon, 15 Aug 2016 15:55:04 +0200 Message-ID: <1838468.8ZbyHXT1Re@kdudka-nb> User-Agent: KMail/4.14.10 (Linux/4.7.0-gentoo; KDE/4.14.20; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 15 Aug 2016 13:55:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) If 'ls --color' outputs to a terminal and a syscall blocks (e.g. while reading a directory from unresponsive network file system), it cannot be interrupted by a signal. This seems to be caused by the code of ls, which sets the SA_RESTART flag on terminating signals. A possible solution would be to reset the flag prior to calling certain blocking syscalls and process the signals synchronously in an EINTR loop. Alternatively, we can document this behavior as intended (or broken by design) and suggest users to disable color output or redirect the output off terminal to work around the issue. Any other idea how to solve it? Originally reported at: https://bugzilla.redhat.com/1365933 Kamil From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: ls --color cannot be interrupted by a signal Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 15 Aug 2016 14:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Kamil Dudka , 24232@debbugs.gnu.org Received: via spool by 24232-submit@debbugs.gnu.org id=B24232.147127291624395 (code B ref 24232); Mon, 15 Aug 2016 14:56:01 +0000 Received: (at 24232) by debbugs.gnu.org; 15 Aug 2016 14:55:16 +0000 Received: from localhost ([127.0.0.1]:58426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZJIK-0006LP-3m for submit@debbugs.gnu.org; Mon, 15 Aug 2016 10:55:16 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:40596) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZJIJ-0006LH-BJ for 24232@debbugs.gnu.org; Mon, 15 Aug 2016 10:55:15 -0400 Received: from [192.168.1.80] (unknown [109.76.72.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id EA151243; Mon, 15 Aug 2016 15:55:13 +0100 (IST) References: <1838468.8ZbyHXT1Re@kdudka-nb> From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: <57B1D7D1.7@draigBrady.com> Date: Mon, 15 Aug 2016 15:55:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1838468.8ZbyHXT1Re@kdudka-nb> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 15/08/16 14:55, Kamil Dudka wrote: > If 'ls --color' outputs to a terminal and a syscall blocks (e.g. while reading > a directory from unresponsive network file system), it cannot be interrupted > by a signal. > > This seems to be caused by the code of ls, which sets the SA_RESTART flag on > terminating signals. A possible solution would be to reset the flag prior to > calling certain blocking syscalls and process the signals synchronously in an > EINTR loop. Sounds expensive > Alternatively, we can document this behavior as intended (or broken by design) > and suggest users to disable color output or redirect the output off terminal > to work around the issue. > > Any other idea how to solve it? > > Originally reported at: https://bugzilla.redhat.com/1365933 The signal catching functionality originated trying to restore terminal color: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v4.5.3-89-g8549068 That was adjusted to only outputting reset chars once for multiple signals, http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v5.2.1-357-geae1b7f and not outputting reset chars at arbitrary places as that messes up multi-byte chars: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v5.2.1-368-gadc30a8 Maybe we should just buffer internally at put_indicator (&color_indicator[C_LEFT]); and output only at put_indicator (&color_indicator[C_RIGHT]) or equivalent. That wouldn't introduce significant overhead I think. Pádraig From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: ls --color cannot be interrupted by a signal Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 15 Aug 2016 15:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 24232@debbugs.gnu.org Received: via spool by 24232-submit@debbugs.gnu.org id=B24232.147127636429507 (code B ref 24232); Mon, 15 Aug 2016 15:53:02 +0000 Received: (at 24232) by debbugs.gnu.org; 15 Aug 2016 15:52:44 +0000 Received: from localhost ([127.0.0.1]:58466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZKBw-0007fr-Hl for submit@debbugs.gnu.org; Mon, 15 Aug 2016 11:52:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZKBu-0007fg-HG for 24232@debbugs.gnu.org; Mon, 15 Aug 2016 11:52:43 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8241483F3C; Mon, 15 Aug 2016 15:52:38 +0000 (UTC) Received: from kdudka-nb.localnet (unused-4-106.brq.redhat.com [10.34.4.106]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7FFqZ1R026938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Aug 2016 11:52:36 -0400 From: Kamil Dudka Date: Mon, 15 Aug 2016 17:52:38 +0200 Message-ID: <1856776.6DGTyJkcht@kdudka-nb> User-Agent: KMail/4.14.10 (Linux/4.7.0-gentoo; KDE/4.14.20; x86_64; ; ) In-Reply-To: <57B1D7D1.7@draigBrady.com> References: <1838468.8ZbyHXT1Re@kdudka-nb> <57B1D7D1.7@draigBrady.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 15 Aug 2016 15:52:38 +0000 (UTC) X-Spam-Score: -5.6 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.6 (-----) On Monday, August 15, 2016 15:55:13 P=E1draig Brady wrote: > The signal catching functionality originated trying to restore termin= al > color: > http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3Dv4= .5.3-89-g854 > 9068 >=20 > That was adjusted to only outputting reset chars once for multiple si= gnals, > http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3Dv5= .2.1-357-geae > 1b7f >=20 > and not outputting reset chars at arbitrary places as that messes up > multi-byte chars: > http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3Dv5= .2.1-368-gad > c30a8 >=20 > Maybe we should just buffer internally at put_indicator > (&color_indicator[C_LEFT]); and output only at put_indicator > (&color_indicator[C_RIGHT]) or equivalent. That wouldn't introduce > significant overhead I think. Internal buffering is certainly doable. I guess there is some gnulib m= odule=20 that already implements such a buffer? However, what to do with signal handling then? Drop the SA_RESTART fla= g and=20 implement EINTR loop only for the fwrite() call that writes data with e= scape=20 sequences to the terminal? Kamil > P=E1draig From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: ls --color cannot be interrupted by a signal Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 15 Aug 2016 17:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Kamil Dudka Cc: 24232@debbugs.gnu.org Received: via spool by 24232-submit@debbugs.gnu.org id=B24232.14712828076855 (code B ref 24232); Mon, 15 Aug 2016 17:41:02 +0000 Received: (at 24232) by debbugs.gnu.org; 15 Aug 2016 17:40:07 +0000 Received: from localhost ([127.0.0.1]:58511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZLrq-0001mV-OI for submit@debbugs.gnu.org; Mon, 15 Aug 2016 13:40:06 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:41118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZLro-0001mM-HV for 24232@debbugs.gnu.org; Mon, 15 Aug 2016 13:40:05 -0400 Received: from [192.168.1.80] (unknown [109.76.72.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 429BA243; Mon, 15 Aug 2016 18:40:01 +0100 (IST) References: <1838468.8ZbyHXT1Re@kdudka-nb> <57B1D7D1.7@draigBrady.com> <1856776.6DGTyJkcht@kdudka-nb> From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: <57B1FE70.2020603@draigBrady.com> Date: Mon, 15 Aug 2016 18:40:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1856776.6DGTyJkcht@kdudka-nb> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 15/08/16 16:52, Kamil Dudka wrote: > On Monday, August 15, 2016 15:55:13 Pádraig Brady wrote: >> The signal catching functionality originated trying to restore terminal >> color: >> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v4.5.3-89-g854 >> 9068 >> >> That was adjusted to only outputting reset chars once for multiple signals, >> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v5.2.1-357-geae >> 1b7f >> >> and not outputting reset chars at arbitrary places as that messes up >> multi-byte chars: >> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v5.2.1-368-gad >> c30a8 >> >> Maybe we should just buffer internally at put_indicator >> (&color_indicator[C_LEFT]); and output only at put_indicator >> (&color_indicator[C_RIGHT]) or equivalent. That wouldn't introduce >> significant overhead I think. > > Internal buffering is certainly doable. I guess there is some gnulib module > that already implements such a buffer? Not that I noticed. The conditions for flushing tend to vary per app, so we've slightly different variations in various utils, like lbuf_flush() in factor(1), and buffer_or_output() in relpath(1). We could take advantage of a PATH_MAX+A_BIT sized buffer to avoid realloc complexities. Actually we already buffer in quote_name(), so rather than outputting the color sequences separately in print_name_with_quoting(), we could pass those into quote_name() and it could write to its buffer, and output the START+name+END atomically. > However, what to do with signal handling then? Drop the SA_RESTART flag and > implement EINTR loop only for the fwrite() call that writes data with escape > sequences to the terminal? Hrm, the buffering above would avoid needing to explicitly output the color reset sequence upon exit, but it would not avoid the need to fflush(), since stdio might actually output the start and end color sequences in separate writes. Drats, so if we had to manage signals anyway to do the fflush() the buffering probably isn't worth it. I'm not sure how to improve this. Perhaps we should look at only enabling the signal handling before printing, in the common case of outputting the sorted entries of a single directory. In that way the open(), stat() etc. would be done with standard signal handling. From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: [PATCH] ls: postpone installation of signal handlers Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 06 Sep 2016 15:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 24232@debbugs.gnu.org Received: via spool by 24232-submit@debbugs.gnu.org id=B24232.14731763293093 (code B ref 24232); Tue, 06 Sep 2016 15:39:02 +0000 Received: (at 24232) by debbugs.gnu.org; 6 Sep 2016 15:38:49 +0000 Received: from localhost ([127.0.0.1]:51516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhISR-0000ne-2P for submit@debbugs.gnu.org; Tue, 06 Sep 2016 11:38:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhISJ-0000nL-07 for 24232@debbugs.gnu.org; Tue, 06 Sep 2016 11:38:41 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10EACC05678C; Tue, 6 Sep 2016 15:38:29 +0000 (UTC) Received: from f24.localdomain (unused-4-123.brq.redhat.com [10.34.4.123]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u86FcR7V024848; Tue, 6 Sep 2016 11:38:27 -0400 From: Kamil Dudka Date: Tue, 6 Sep 2016 17:38:26 +0200 Message-Id: <1473176306-22325-1-git-send-email-kdudka@redhat.com> In-Reply-To: <57B1FE70.2020603@draigBrady.com> References: <57B1FE70.2020603@draigBrady.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 06 Sep 2016 15:38:29 +0000 (UTC) X-Spam-Score: -6.1 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.1 (------) ... until they are actually needed. That is right before the first escape sequence is printed to a terminal. * src/ls.c (sigs): Moved from main() to global scope to make it available in put_indicator(), too. Renamed to prevent identifier clashes with parameters of subsequent function definitions. (nsigs): Likewise. (caught_sig): Likewise. (main): Code installing signal handlers moved to put_indicator() in order not to keep default signal handling untouched as long as possible. Adjusted condition for restoring signal handlers to reflect the change. (put_indicator): Install signal handlers if called for the very first time. It uses the same code that was in main() prior to this commit. * NEWS: Mention the change. See https://bugzilla.redhat.com/1365933 --- NEWS | 3 ++ src/ls.c | 167 +++++++++++++++++++++++++++++++-------------------------------- 2 files changed, 86 insertions(+), 84 deletions(-) diff --git a/NEWS b/NEWS index 736b95e..d4af96f 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ GNU coreutils NEWS -*- outline -*- System V style platforms where this information is available only in the global variable 'tzname'. [bug introduced in coreutils-8.24] + ls is now fully responsive to signals until the first escape sequence is + written to a terminal. + nl now resets numbering for each page section rather than just for each page. [This bug was present in "the beginning".] diff --git a/src/ls.c b/src/ls.c index 3572060..c438f61 100644 --- a/src/ls.c +++ b/src/ls.c @@ -753,6 +753,36 @@ static char const *long_time_format[2] = N_("%b %e %H:%M") }; +/* The signals that are trapped, and the number of such signals. */ +static int const sigs[] = +{ + /* This one is handled specially. */ + SIGTSTP, + + /* The usual suspects. */ + SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, +#ifdef SIGPOLL + SIGPOLL, +#endif +#ifdef SIGPROF + SIGPROF, +#endif +#ifdef SIGVTALRM + SIGVTALRM, +#endif +#ifdef SIGXCPU + SIGXCPU, +#endif +#ifdef SIGXFSZ + SIGXFSZ, +#endif +}; +enum { nsigs = ARRAY_CARDINALITY (sigs) }; + +#if ! SA_NOCLDSTOP +static bool caught_sig[nsigs]; +#endif + /* The set of signals that are caught. */ static sigset_t caught_signals; @@ -1251,36 +1281,6 @@ main (int argc, char **argv) struct pending *thispend; int n_files; - /* The signals that are trapped, and the number of such signals. */ - static int const sig[] = - { - /* This one is handled specially. */ - SIGTSTP, - - /* The usual suspects. */ - SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, -#ifdef SIGPOLL - SIGPOLL, -#endif -#ifdef SIGPROF - SIGPROF, -#endif -#ifdef SIGVTALRM - SIGVTALRM, -#endif -#ifdef SIGXCPU - SIGXCPU, -#endif -#ifdef SIGXFSZ - SIGXFSZ, -#endif - }; - enum { nsigs = ARRAY_CARDINALITY (sig) }; - -#if ! SA_NOCLDSTOP - bool caught_sig[nsigs]; -#endif - initialize_main (&argc, &argv); set_program_name (argv[0]); setlocale (LC_ALL, ""); @@ -1314,46 +1314,6 @@ main (int argc, char **argv) || (is_colored (C_EXEC) && color_symlink_as_referent) || (is_colored (C_MISSING) && format == long_format)) check_symlink_color = true; - - /* If the standard output is a controlling terminal, watch out - for signals, so that the colors can be restored to the - default state if "ls" is suspended or interrupted. */ - - if (0 <= tcgetpgrp (STDOUT_FILENO)) - { - int j; -#if SA_NOCLDSTOP - struct sigaction act; - - sigemptyset (&caught_signals); - for (j = 0; j < nsigs; j++) - { - sigaction (sig[j], NULL, &act); - if (act.sa_handler != SIG_IGN) - sigaddset (&caught_signals, sig[j]); - } - - act.sa_mask = caught_signals; - act.sa_flags = SA_RESTART; - - for (j = 0; j < nsigs; j++) - if (sigismember (&caught_signals, sig[j])) - { - act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler; - sigaction (sig[j], &act, NULL); - } -#else - for (j = 0; j < nsigs; j++) - { - caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN); - if (caught_sig[j]) - { - signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler); - siginterrupt (sig[j], 0); - } - } -#endif - } } if (dereference == DEREF_UNDEFINED) @@ -1466,31 +1426,29 @@ main (int argc, char **argv) print_dir_name = true; } - if (print_with_color) + if (print_with_color && used_color) { int j; - if (used_color) - { - /* Skip the restore when it would be a no-op, i.e., - when left is "\033[" and right is "m". */ - if (!(color_indicator[C_LEFT].len == 2 - && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0 - && color_indicator[C_RIGHT].len == 1 - && color_indicator[C_RIGHT].string[0] == 'm')) - restore_default_color (); - } + /* Skip the restore when it would be a no-op, i.e., + when left is "\033[" and right is "m". */ + if (!(color_indicator[C_LEFT].len == 2 + && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0 + && color_indicator[C_RIGHT].len == 1 + && color_indicator[C_RIGHT].string[0] == 'm')) + restore_default_color (); + fflush (stdout); /* Restore the default signal handling. */ #if SA_NOCLDSTOP for (j = 0; j < nsigs; j++) - if (sigismember (&caught_signals, sig[j])) - signal (sig[j], SIG_DFL); + if (sigismember (&caught_signals, sigs[j])) + signal (sigs[j], SIG_DFL); #else for (j = 0; j < nsigs; j++) if (caught_sig[j]) - signal (sig[j], SIG_DFL); + signal (sigs[j], SIG_DFL); #endif /* Act on any signals that arrived before the default was restored. @@ -4475,6 +4433,47 @@ put_indicator (const struct bin_str *ind) if (! used_color) { used_color = true; + + /* If the standard output is a controlling terminal, watch out + for signals, so that the colors can be restored to the + default state if "ls" is suspended or interrupted. */ + + if (0 <= tcgetpgrp (STDOUT_FILENO)) + { + int j; +#if SA_NOCLDSTOP + struct sigaction act; + + sigemptyset (&caught_signals); + for (j = 0; j < nsigs; j++) + { + sigaction (sigs[j], NULL, &act); + if (act.sa_handler != SIG_IGN) + sigaddset (&caught_signals, sigs[j]); + } + + act.sa_mask = caught_signals; + act.sa_flags = SA_RESTART; + + for (j = 0; j < nsigs; j++) + if (sigismember (&caught_signals, sigs[j])) + { + act.sa_handler = sigs[j] == SIGTSTP ? stophandler : sighandler; + sigaction (sigs[j], &act, NULL); + } +#else + for (j = 0; j < nsigs; j++) + { + caught_sig[j] = (signal (sigs[j], SIG_IGN) != SIG_IGN); + if (caught_sig[j]) + { + signal (sigs[j], sigs[j] == SIGTSTP ? stophandler : sighandler); + siginterrupt (sigs[j], 0); + } + } +#endif + } + prep_non_filename_text (); } -- 2.7.4 From unknown Sun Sep 07 01:43:36 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Kamil Dudka Subject: bug#24232: closed (Re: bug#24232: [PATCH] ls: postpone installation of signal handlers) Message-ID: References: <57CEE7CC.3080903@draigBrady.com> <1838468.8ZbyHXT1Re@kdudka-nb> X-Gnu-PR-Message: they-closed 24232 X-Gnu-PR-Package: coreutils Reply-To: 24232@debbugs.gnu.org Date: Tue, 06 Sep 2016 16:00:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1473177603-11418-1" This is a multi-part message in MIME format... ------------=_1473177603-11418-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24232: ls --color cannot be interrupted by a signal 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 24232@debbugs.gnu.org. --=20 24232: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24232 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1473177603-11418-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24232-done) by debbugs.gnu.org; 6 Sep 2016 15:59:16 +0000 Received: from localhost ([127.0.0.1]:51550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhImK-0002we-3n for submit@debbugs.gnu.org; Tue, 06 Sep 2016 11:59:16 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:50902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhImI-0002wU-3a for 24232-done@debbugs.gnu.org; Tue, 06 Sep 2016 11:59:14 -0400 Received: from [192.168.1.80] (unknown [109.77.193.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 8396195; Tue, 6 Sep 2016 16:59:12 +0100 (IST) Subject: Re: bug#24232: [PATCH] ls: postpone installation of signal handlers To: Kamil Dudka References: <57B1FE70.2020603@draigBrady.com> <1473176306-22325-1-git-send-email-kdudka@redhat.com> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <57CEE7CC.3080903@draigBrady.com> Date: Tue, 6 Sep 2016 16:59:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1473176306-22325-1-git-send-email-kdudka@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24232-done Cc: 24232-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 06/09/16 16:38, Kamil Dudka wrote: > ... until they are actually needed. That is right before the first > escape sequence is printed to a terminal. Cool, that's a good improvement. Note I moved the NEWS from "bugs" to "improvements". Also I tweaked a long line to avoid `make syntax-check` failure. Will push later. thanks! Pádraig ------------=_1473177603-11418-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Aug 2016 13:55:21 +0000 Received: from localhost ([127.0.0.1]:58392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZIMK-0004sO-UW for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZIMI-0004sI-6O for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZIMC-00038n-22 for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:12 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZIMB-00038D-Vf for submit@debbugs.gnu.org; Mon, 15 Aug 2016 09:55:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZIM9-0005pq-LA for bug-coreutils@gnu.org; Mon, 15 Aug 2016 09:55:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZIM5-00031m-G2 for bug-coreutils@gnu.org; Mon, 15 Aug 2016 09:55:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZIM5-00031c-AD for bug-coreutils@gnu.org; Mon, 15 Aug 2016 09:55:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C05A2C9DC8 for ; Mon, 15 Aug 2016 13:55:03 +0000 (UTC) Received: from kdudka-nb.localnet (unused-4-106.brq.redhat.com [10.34.4.106]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7FDt1AH028114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 15 Aug 2016 09:55:02 -0400 From: Kamil Dudka To: bug-coreutils@gnu.org Subject: ls --color cannot be interrupted by a signal Date: Mon, 15 Aug 2016 15:55:04 +0200 Message-ID: <1838468.8ZbyHXT1Re@kdudka-nb> User-Agent: KMail/4.14.10 (Linux/4.7.0-gentoo; KDE/4.14.20; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 15 Aug 2016 13:55:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) If 'ls --color' outputs to a terminal and a syscall blocks (e.g. while reading a directory from unresponsive network file system), it cannot be interrupted by a signal. This seems to be caused by the code of ls, which sets the SA_RESTART flag on terminating signals. A possible solution would be to reset the flag prior to calling certain blocking syscalls and process the signals synchronously in an EINTR loop. Alternatively, we can document this behavior as intended (or broken by design) and suggest users to disable color output or redirect the output off terminal to work around the issue. Any other idea how to solve it? Originally reported at: https://bugzilla.redhat.com/1365933 Kamil ------------=_1473177603-11418-1-- From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: [PATCH] ls: postpone installation of signal handlers Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 06 Sep 2016 17:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 24232@debbugs.gnu.org, P@draigBrady.com, kdudka@redhat.com Received: via spool by 24232-submit@debbugs.gnu.org id=B24232.147318154623943 (code B ref 24232); Tue, 06 Sep 2016 17:06:02 +0000 Received: (at 24232) by debbugs.gnu.org; 6 Sep 2016 17:05:46 +0000 Received: from localhost ([127.0.0.1]:51616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhJof-0006E6-Ls for submit@debbugs.gnu.org; Tue, 06 Sep 2016 13:05:45 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhJod-0006Du-T5 for 24232@debbugs.gnu.org; Tue, 06 Sep 2016 13:05:44 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C2EE1160DFF; Tue, 6 Sep 2016 10:05:36 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id AjS3V1iIRec1; Tue, 6 Sep 2016 10:05:36 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2583316111A; Tue, 6 Sep 2016 10:05:36 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id mMsy93aHsZJs; Tue, 6 Sep 2016 10:05:36 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 09625160DFF; Tue, 6 Sep 2016 10:05:36 -0700 (PDT) References: <57B1FE70.2020603@draigBrady.com> <1473176306-22325-1-git-send-email-kdudka@redhat.com> <57CEE7CC.3080903@draigBrady.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <75373f0d-84bd-77ab-c359-30eda2f52b41@cs.ucla.edu> Date: Tue, 6 Sep 2016 10:05:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <57CEE7CC.3080903@draigBrady.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.1 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) On 09/06/2016 08:59 AM, P=C3=A1draig Brady wrote: > Will push later. Before pushing, can you please change the name of "sigs" back to "sig"?=20 I prefer the old name, as "sig[i]" clearly means "signal i", whereas=20 "sigs[i]" is more confusing. (This is one of my pet peeves about array=20 names.) Thanks. From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: [PATCH] ls: postpone installation of signal handlers Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 06 Sep 2016 17:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 24232@debbugs.gnu.org, Kamil Dudka , =?UTF-8?Q?P=C3=A1draig?= Brady Received: via spool by 24232-submit@debbugs.gnu.org id=B24232.147318276825717 (code B ref 24232); Tue, 06 Sep 2016 17:27:01 +0000 Received: (at 24232) by debbugs.gnu.org; 6 Sep 2016 17:26:08 +0000 Received: from localhost ([127.0.0.1]:51620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhK8G-0006gL-E2 for submit@debbugs.gnu.org; Tue, 06 Sep 2016 13:26:08 -0400 Received: from mail-vk0-f46.google.com ([209.85.213.46]:35913) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhK7r-0006fi-FP for 24232@debbugs.gnu.org; Tue, 06 Sep 2016 13:25:58 -0400 Received: by mail-vk0-f46.google.com with SMTP id w64so17575279vkh.3 for <24232@debbugs.gnu.org>; Tue, 06 Sep 2016 10:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=VAnwcPvatxUnZNTkQ5yGsa+fSwYdvxdELzM9fCinVTM=; b=rbWJh0WSodC6Z4sW1OozomIJiikmJrMqEPABkFz/t4ttGKMhl5qbOIUbKjNdkhf5Rg GLLTeuYzqa2i9Xh+GnFmaMmzVKYrOzuwcdN35RM/p3lLGruhGSV1NTIsxS48lIgsRpPd E+2xC3XBPbHkF871/r08HUNGkLITbjsf3urEqYQWvzV8NLapDZ1VkoGs2GkHCRXrNINU /Fl+8dU74CuzJ9cBzbkZqNBgodRALfa2VsL04nbnHzauKs2ROJdZMalDwntxw/l10LCU 3yulNR7zazGPXcg64+RbsTSAbePg2Vksd1vZhmkgBTodgP0XynNEllKBFwxX6ZI7e2Bv AsLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=VAnwcPvatxUnZNTkQ5yGsa+fSwYdvxdELzM9fCinVTM=; b=J+2LpZIzP2BOlGx/O+9DPM5Oq4hyEGMSMtNgoF1lXWxYxVETQImN1/VxAlOilp505N G/GkAjwIxbAcOjoUHwUzT9pJS1BmdtPpnVOBkvihiU2MEdlIxJRdFGp+FeLijFwf00l5 AC7dS7AEVU/rbPDIAMVLn2cmvxBkUs1Z+RB6phY9Z8jqKoiiMalHjyhtseXccI3eoXMo vUj8j1dUByRTjGXYofKc0aFH0ij9PZ1MJekZPc7uNbsyoKJHjQ4VnFQALxrTbhBfg6XJ iHIXqMkeyYF0u5vAi8vHg6kMtKC8gajCv/LPn0PiB/53mMyLERF0XLXFfA/ibeJxQyKr 1HCw== X-Gm-Message-State: AE9vXwORMzFQdV9F5S4mzC2reLOjPWRd1fWaItHC2GxyH3UIpyBKeAHIvkwSDH/w5bSEOlwFEe/EJJhH7Dng7A== X-Received: by 10.31.154.209 with SMTP id c200mr26094693vke.18.1473182345551; Tue, 06 Sep 2016 10:19:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.81.172 with HTTP; Tue, 6 Sep 2016 10:18:45 -0700 (PDT) In-Reply-To: <75373f0d-84bd-77ab-c359-30eda2f52b41@cs.ucla.edu> References: <57B1FE70.2020603@draigBrady.com> <1473176306-22325-1-git-send-email-kdudka@redhat.com> <57CEE7CC.3080903@draigBrady.com> <75373f0d-84bd-77ab-c359-30eda2f52b41@cs.ucla.edu> From: Jim Meyering Date: Tue, 6 Sep 2016 10:18:45 -0700 X-Google-Sender-Auth: AjTc4R4hc7Yg842uBWW04ORhhzY Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, Sep 6, 2016 at 10:05 AM, Paul Eggert wrote: > On 09/06/2016 08:59 AM, P=C3=A1draig Brady wrote: >> >> Will push later. > > > Before pushing, can you please change the name of "sigs" back to "sig"? I > prefer the old name, as "sig[i]" clearly means "signal i", whereas "sigs[= i]" > is more confusing. (This is one of my pet peeves about array names.) Than= ks. I agree. A good argument for "why?" is that we optimize for readability of the more frequent use with an index, sig[i], rather than for the sole declaration, or the less frequent uses of the array name without an index. From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: [PATCH] ls: postpone installation of signal handlers Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 06 Sep 2016 18:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Jim Meyering , Paul Eggert Cc: 24232@debbugs.gnu.org, Kamil Dudka Received: via spool by 24232-submit@debbugs.gnu.org id=B24232.147318523729638 (code B ref 24232); Tue, 06 Sep 2016 18:08:01 +0000 Received: (at 24232) by debbugs.gnu.org; 6 Sep 2016 18:07:17 +0000 Received: from localhost ([127.0.0.1]:51676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhKmD-0007hx-Bt for submit@debbugs.gnu.org; Tue, 06 Sep 2016 14:07:17 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:51442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhKmB-0007ho-MD for 24232@debbugs.gnu.org; Tue, 06 Sep 2016 14:07:16 -0400 Received: from [192.168.1.80] (unknown [109.77.193.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 479DC95; Tue, 6 Sep 2016 19:07:14 +0100 (IST) References: <57B1FE70.2020603@draigBrady.com> <1473176306-22325-1-git-send-email-kdudka@redhat.com> <57CEE7CC.3080903@draigBrady.com> <75373f0d-84bd-77ab-c359-30eda2f52b41@cs.ucla.edu> From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: <57CF05D1.7050800@draigBrady.com> Date: Tue, 6 Sep 2016 19:07:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 06/09/16 18:18, Jim Meyering wrote: > On Tue, Sep 6, 2016 at 10:05 AM, Paul Eggert wrote: >> On 09/06/2016 08:59 AM, Pádraig Brady wrote: >>> >>> Will push later. >> >> >> Before pushing, can you please change the name of "sigs" back to "sig"? I >> prefer the old name, as "sig[i]" clearly means "signal i", whereas "sigs[i]" >> is more confusing. (This is one of my pet peeves about array names.) Thanks. > > I agree. > A good argument for "why?" is that we optimize for readability of the > more frequent use with an index, sig[i], rather than for the sole > declaration, or the less frequent uses of the array name without an > index. Ok done. I consolidated signal handler setup and restoration to a single function to allow that. From unknown Sun Sep 07 01:43:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24232: [PATCH] ls: postpone installation of signal handlers Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 07 Sep 2016 08:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24232 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 24232@debbugs.gnu.org Cc: eggert@cs.ucla.edu, P@draigbrady.com, jim@meyering.net X-Debbugs-Original-To: bug-coreutils@gnu.org X-Debbugs-Original-Cc: 24232@debbugs.gnu.org, Paul Eggert , =?UTF-8?Q?P=C3=A1draig?= Brady , Jim Meyering Received: via spool by submit@debbugs.gnu.org id=B.147323616016986 (code B ref -1); Wed, 07 Sep 2016 08:16:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Sep 2016 08:16:00 +0000 Received: from localhost ([127.0.0.1]:51895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhY1Y-0004Pu-GF for submit@debbugs.gnu.org; Wed, 07 Sep 2016 04:16:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhY1W-0004Pe-Dn for submit@debbugs.gnu.org; Wed, 07 Sep 2016 04:15:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhY1M-0002aE-75 for submit@debbugs.gnu.org; Wed, 07 Sep 2016 04:15:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhY1M-0002Zk-4T for submit@debbugs.gnu.org; Wed, 07 Sep 2016 04:15:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhY1F-0006OI-OI for bug-coreutils@gnu.org; Wed, 07 Sep 2016 04:15:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhY1A-0002XA-Qk for bug-coreutils@gnu.org; Wed, 07 Sep 2016 04:15:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhY1A-0002X2-Kh for bug-coreutils@gnu.org; Wed, 07 Sep 2016 04:15:36 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 292E84E32E; Wed, 7 Sep 2016 08:15:35 +0000 (UTC) Received: from kdudka-nb.localnet (unused-4-122.brq.redhat.com [10.34.4.122]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u878FXGE004376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 7 Sep 2016 04:15:34 -0400 From: Kamil Dudka Date: Wed, 07 Sep 2016 10:15:37 +0200 Message-ID: <3688508.fqXSmC52Nu@kdudka-nb> User-Agent: KMail/4.14.10 (Linux/4.7.2-gentoo; KDE/4.14.20; x86_64; ; ) In-Reply-To: <57CF05D1.7050800@draigBrady.com> References: <57B1FE70.2020603@draigBrady.com> <57CF05D1.7050800@draigBrady.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 07 Sep 2016 08:15:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) On Tuesday, September 06, 2016 19:07:13 P=E1draig Brady wrote: > On 06/09/16 18:18, Jim Meyering wrote: > > On Tue, Sep 6, 2016 at 10:05 AM, Paul Eggert w= rote: > >> On 09/06/2016 08:59 AM, P=E1draig Brady wrote: > >>> Will push later. > >>=20 > >> Before pushing, can you please change the name of "sigs" back to "= sig"? I > >> prefer the old name, as "sig[i]" clearly means "signal i", whereas= > >> "sigs[i]" is more confusing. (This is one of my pet peeves about a= rray > >> names.) Thanks.>=20 > > I agree. > > A good argument for "why?" is that we optimize for readability of t= he > > more frequent use with an index, sig[i], rather than for the sole > > declaration, or the less frequent uses of the array name without an= > > index. >=20 > Ok done. >=20 > I consolidated signal handler setup and restoration to a single funct= ion > to allow that. Thanks for review! I am fine with all the proposals. Please let me kn= ow in case any resubmission is needed. Kamil