Received: (at 36488) by debbugs.gnu.org; 29 Aug 2021 22:00:27 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 29 18:00:27 2021 Received: from localhost ([127.0.0.1]:57619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mKSqp-00014V-2o for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 18:00:27 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:46030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mKSqm-0000wQ-MK for 36488 <at> debbugs.gnu.org; Sun, 29 Aug 2021 18:00:25 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A8E3916005A; Sun, 29 Aug 2021 15:00:18 -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 tbXeKeh9G-bj; Sun, 29 Aug 2021 15:00:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D4AC81600FC; Sun, 29 Aug 2021 15:00:17 -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 3cp_Vz04q7BF; Sun, 29 Aug 2021 15:00:17 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 61F4616005A; Sun, 29 Aug 2021 15:00:17 -0700 (PDT) To: Thiago Jung Bauermann <bauermann@HIDDEN> References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> <10257051.elIQoDPIPK@popigai> <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> <12562597.lilg3O6Q0V@popigai> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department Subject: Re: [bug-diffutils] bug#36488: diffutils 3.7 make check failure ppc64le opensuse on colors test Message-ID: <6a34af3f-9f6c-ccb6-f68c-99fb54220e57@HIDDEN> Date: Sun, 29 Aug 2021 15:00:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <12562597.lilg3O6Q0V@popigai> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 36488 Cc: =?UTF-8?B?RnLDqWTDqXJpYyBCb25uYXJk?= <frediz@HIDDEN>, Santiago Vila <sanvila@HIDDEN>, 36488 <at> debbugs.gnu.org, Normand <normand@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.4 (---) On 8/29/21 2:26 PM, Thiago Jung Bauermann wrote: > Unfortunately the colors test still hits the same problem in some runs = even > with this patch applied. Too bad. I reopened the bug report. > Do you have access to a powerpc64le-linux machine? If you want, I can g= ive > you an account on the VM I=E2=80=99m using. An account would be helpful, thanks.
bug-diffutils@HIDDEN
:bug#36488
; Package diffutils
.
Full text available.Debbugs Internal Request <help-debbugs@HIDDEN>
to internal_control <at> debbugs.gnu.org
.
Full text available.Received: (at 36488) by debbugs.gnu.org; 29 Aug 2021 21:26:33 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 29 17:26:33 2021 Received: from localhost ([127.0.0.1]:57590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mKSK1-00068p-BM for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 17:26:33 -0400 Received: from mx.kolabnow.com ([95.128.36.41]:6722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <bauermann@HIDDEN>) id 1mKSJx-00068M-0B for 36488 <at> debbugs.gnu.org; Sun, 29 Aug 2021 17:26:29 -0400 Received: from localhost (unknown [127.0.0.1]) by ext-mx-out001.mykolab.com (Postfix) with ESMTP id 5FA8CB4A; Sun, 29 Aug 2021 23:26:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:date:subject:subject :from:from:received:received:received; s=dkim20160331; t= 1630272378; x=1632086779; bh=XhcFuaASC6CVEfm3XPVL1bvlmplUVxARvtg HXnZGCfE=; b=4lfGlvbzXxH1XTlY7O2e94ZHEoJByYhRl7ci0qvT1/GktR/iTds cc+3kjnIBSQR0/f8UgJCnatWr+Gd/15bsd/1GhXHrMgfZ6+GkW+etAfYEGeMfekD U9OKKCr7Tat56NLIUqECAuWmr7HvnzuTCKhOPpvePLonCrKw4irpgQuiTnbo6WKa tSwXAMF0gwZPKLZOrB3GjNHoPXZec127pTu/UTW1KoKC0pbppZwRDd/dTPxk255T VqplqhEcuCvVJTxCDj6W3+fobnxxjOk1U3I6xF+IWaTYVJzhcp8YITFzO27u9lwt s8HSjhQRoRy2l7Zi3+WzleS4XvpyQuys5kfapVYEhXEsMIrbfokpI/E13yfFtkUm ScWGZ3sJ3hKprI/x6KkgsBm3mRIE6I0IDHDtLx7eOJDkfihQjC4Z4KEeiDauDiHJ Y8sKDYRinoI8PQEwbGO4/cJNC+tv9BT90WtuKsIlnKkGuqLIn9R71Zblvhs7mkU5 9+oKykdjSP47BR2Guz0HR80QX8tNSnK1QDXnJ9FTN2m/jYei43eHJ/0hd1RsjVeu 98TrqbvnwE8kX+xOBarDBBM1oR1BB21xGoA2qLuZvlIQ6wW9MiQTInOHf3q5qoIG aLCB9pW51C0OYMx5IBH0sBKDYOejy2rheFN/diqlBg55ARhWx80dif7Y= X-Virus-Scanned: amavisd-new at mykolab.com X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-10 required=5 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mx5xt2djpUCY; Sun, 29 Aug 2021 23:26:18 +0200 (CEST) Received: from int-mx003.mykolab.com (unknown [10.9.13.3]) by ext-mx-out001.mykolab.com (Postfix) with ESMTPS id 9020FAAD; Sun, 29 Aug 2021 23:26:16 +0200 (CEST) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx003.mykolab.com (Postfix) with ESMTPS id 4214F3571; Sun, 29 Aug 2021 23:26:12 +0200 (CEST) From: Thiago Jung Bauermann <bauermann@HIDDEN> To: Paul Eggert <eggert@HIDDEN> Subject: Re: [bug-diffutils] bug#36488: diffutils 3.7 make check failure ppc64le opensuse on colors test Date: Sun, 29 Aug 2021 18:26:01 -0300 Message-ID: <12562597.lilg3O6Q0V@popigai> In-Reply-To: <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> <10257051.elIQoDPIPK@popigai> <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36488 Cc: =?ISO-8859-1?Q?Fr=E9d=E9ric?= Bonnard <frediz@HIDDEN>, Santiago Vila <sanvila@HIDDEN>, 36488 <at> debbugs.gnu.org, Normand <normand@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello Paul, Em domingo, 29 de agosto de 2021, =C3=A0s 04:22:27 -03, Paul Eggert escreve= u: > On 8/28/21 8:40 AM, Thiago Jung Bauermann via bug-diffutils via All >=20 > diffutils discussion. wrote: > > I believe this is the same problem reported in bug 34519. > > The Debian build also fails with "diff: standard output: Broken pipe". >=20 > Thanks for tracking that down. Fr=C3=A9d=C3=A9ric's analysis in > <https://bugs.debian.org/922552#19> was helpful. >=20 > I found some time to look into this bug, and installed into > Savannah.gnu.org diffutils the attached patch, which I hope fixes the > bug although I don't have the relevant platform to test it. Please give > it a try. Awesome! That was very fast. Thank you very much. > Once this patch is part of a release, Debian shouldn't need any patches > for diffutils. >=20 > For now I am closing the diffutils bug report > <https://bugs.gnu.org/36488>; if I was too optimistic and the patch > doesn't fix things we can always reopen it. Unfortunately the colors test still hits the same problem in some runs even= =20 with this patch applied. Do you have access to a powerpc64le-linux machine? If you want, I can give= =20 you an account on the VM I=E2=80=99m using. =2D-=20 Thanks, Thiago
bug-diffutils@HIDDEN
:bug#36488
; Package diffutils
.
Full text available.Received: (at 36488) by debbugs.gnu.org; 29 Aug 2021 18:20:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 29 14:20:17 2021 Received: from localhost ([127.0.0.1]:57340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mKPPk-0005Xi-Tv for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 14:20:17 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mKPPi-0005XK-WB for 36488 <at> debbugs.gnu.org; Sun, 29 Aug 2021 14:20:16 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A9292160083; Sun, 29 Aug 2021 11:20:08 -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 q-oqT8UPz_z4; Sun, 29 Aug 2021 11:20:04 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E80EC1600A7; Sun, 29 Aug 2021 11:20:03 -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 7I3NGHUlA0KF; Sun, 29 Aug 2021 11:20:03 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BD238160083; Sun, 29 Aug 2021 11:20:03 -0700 (PDT) Subject: Re: bug#36488: diffutils 3.7 make check failure ppc64le opensuse on colors test To: Gisle Vanem <gisle.vanem@HIDDEN> References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> <10257051.elIQoDPIPK@popigai> <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> <0b916f46-2495-3f86-b27d-5b151b8bc7f0@HIDDEN> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department Message-ID: <3986b30e-cc23-5cb2-9ddb-d2f56e280d9a@HIDDEN> Date: Sun, 29 Aug 2021 11:20:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <0b916f46-2495-3f86-b27d-5b151b8bc7f0@HIDDEN> Content-Type: multipart/mixed; boundary="------------49226973C0F681E13A18E7A2" Content-Language: en-US X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 36488 Cc: 36488 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.4 (---) This is a multi-part message in MIME format. --------------49226973C0F681E13A18E7A2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 8/29/21 4:13 AM, Gisle Vanem wrote: > With some added trace-code I found this was for > SIGHUP (=1) which is not supported. So I just dropped > SIGHUP from the list. Thanks for reporting that. I installed the attached, which I hope fixes the problem in a more-portable way. Please give it a try. In hindsight perhaps 'diff' should never have added signal handling, as it's a bug magnet. If your display's colors get messed up due to ^C the shell should fix the colors, not 'diff'. --------------49226973C0F681E13A18E7A2 Content-Type: text/x-patch; charset=UTF-8; name="0001-diff-port-better-to-MS-Windows.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-diff-port-better-to-MS-Windows.patch" From 078321ebeb4d9e83e900278154dbf47ec2758295 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@HIDDEN> Date: Sun, 29 Aug 2021 11:14:14 -0700 Subject: [PATCH] diff: port better to MS-Windows Problem reported by Gisle Vanem (Bug#36488#30). * src/util.c (xsigaction) [SA_NOCLDSTOP]: Remove; no longer needed. (install_signal_handlers): If the first call to sigaction or signal fails, do not exit; just skip the signal and continue, in case the runtime does not support the signal even though the corresponding SIG* macro is defined. --- src/util.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/util.c b/src/util.c index 8e676c8..f8b911a 100644 --- a/src/util.c +++ b/src/util.c @@ -159,16 +159,7 @@ print_message_queue (void) } } - -#if SA_NOCLDSTOP -static void -xsigaction (int sig, struct sigaction const *restrict act, - struct sigaction *restrict oact) -{ - if (sigaction (sig, act, oact) != 0) - pfatal_with_name ("sigaction"); -} -#endif +/* Signal handling, needed for restoring default colors. */ static void xsigaddset (sigset_t *set, int sig) @@ -321,8 +312,7 @@ install_signal_handlers (void) for (int j = 0; j < nsigs; j++) { struct sigaction actj; - xsigaction (sig[j], NULL, &actj); - if (actj.sa_handler != SIG_IGN) + if (sigaction (sig[j], NULL, &actj) == 0 && actj.sa_handler != SIG_IGN) xsigaddset (&caught_signals, sig[j]); } @@ -334,19 +324,23 @@ install_signal_handlers (void) if (xsigismember (&caught_signals, sig[j])) { act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler; - xsigaction (sig[j], &act, NULL); + if (sigaction (sig[j], &act, NULL) != 0) + pfatal_with_name ("sigaction"); some_signals_caught = true; } #else for (int j = 0; j < nsigs; j++) - if (xsignal (sig[j], SIG_IGN) != SIG_IGN) - { - xsigaddset (&caught_signals, sig[j]); - xsignal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler); - some_signals_caught = true; - if (siginterrupt (sig[j], 0) != 0) - pfatal_with_name ("siginterrupt"); - } + { + signal_handler h = signal (sig[j], SIG_IGN); + if (h != SIG_IGN && h != SIG_ERR) + { + xsigaddset (&caught_signals, sig[j]); + xsignal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler); + some_signals_caught = true; + if (siginterrupt (sig[j], 0) != 0) + pfatal_with_name ("siginterrupt"); + } + } #endif } -- 2.30.2 --------------49226973C0F681E13A18E7A2--
bug-diffutils@HIDDEN
:bug#36488
; Package diffutils
.
Full text available.Received: (at submit) by debbugs.gnu.org; 29 Aug 2021 11:14:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 29 07:14:04 2021 Received: from localhost ([127.0.0.1]:55683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mKIlI-00010f-K1 for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 07:14:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:34102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <gisle.vanem@HIDDEN>) id 1mKIlH-00010Y-4B for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 07:14:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <gisle.vanem@HIDDEN>) id 1mKIlG-0005AK-Rl for bug-diffutils@HIDDEN; Sun, 29 Aug 2021 07:14:02 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:36561) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <gisle.vanem@HIDDEN>) id 1mKIlE-0005VO-Li for bug-diffutils@HIDDEN; Sun, 29 Aug 2021 07:14:02 -0400 Received: by mail-lj1-x22a.google.com with SMTP id p15so20321370ljn.3 for <bug-diffutils@HIDDEN>; Sun, 29 Aug 2021 04:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=Y+kfBwyEirmyXKBYUpJeqoADRfn1to7C/XExghFuFGA=; b=nXtmzp/x0Leykd80CRb+J89PM9jplZ/vqDdJVXAlZXtOKB2NVpotemdRWk9xUw0KyE 7nzJTVYqLTqT0fHHu+cYSANuXKQqISfHiJLi/9dUBblBjRS5QUqs0GVLK/qqrnYzIVPw V1KDio7uu6jQ+haE3yp4n5JRH8lVWv+6VGylRIbpxIVeb5uozRIDmhTCTpCV+ovFZrxy L1Ja0ZVeqN5sKop4CbeDlaqhbZRSaaApO5r90Ay/5usgChoQZpGyvW75ktIzQ8mzdqGB TjQbJ5EALPm/W+XBlXE4Nd5fBJa17iLatEbJ7awBUX0ck9CUBU2GO84UM65uI1nAPKDA BlWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Y+kfBwyEirmyXKBYUpJeqoADRfn1to7C/XExghFuFGA=; b=HuN+HDLQJEaGunTS0K5lnmMt8RjsxdfmMzMk+U1g+dRrH8bKu9gbNKv8ejfaVAwBT6 qcc7kpRJb7HRnwFZLSMbh0XuEpq5O8wG5uryQ8clUE3pJToMUJoomiLAALGJSCN0CDdH pTeg+b4Y773P2gfGcjW4j1E164+OJCt5+g2lKFyYTD3RC26iZtwUK/fndvAHOCEhXosz 6gsKoL+eIwcwedDPgsWhkaRu92Nao8YOepSd86wSxUWXMnEoe1FQEIMqo93Edir8y+D6 ZzBGF42Ed9lWibVB7lZorH9SvvvYpbOqBECjx/gQYQNox4qpQExdTa0hdZRoK94+JDD4 hwUw== X-Gm-Message-State: AOAM531ejpKdA+0dwfeLh+IQpZ8adBsSi4rta1gshW0GhMe+x/+k0CLA 8MGVKnCUAe6rUFZ48JcHmWNUzYlI0m4= X-Google-Smtp-Source: ABdhPJxWnnLRYYSqwQ3FOx0B4HOQE3gP7KOvsaaJddXzdF6NQICmITp4s1L4ee+hV/wBR2DurUBR6Q== X-Received: by 2002:a2e:58c:: with SMTP id 134mr16128977ljf.269.1630235638053; Sun, 29 Aug 2021 04:13:58 -0700 (PDT) Received: from [10.0.0.10] (ti0040q160-0004.bb.online.no. [88.95.101.5]) by smtp.gmail.com with ESMTPSA id o18sm582593lfg.109.2021.08.29.04.13.57 for <bug-diffutils@HIDDEN> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Aug 2021 04:13:57 -0700 (PDT) From: Gisle Vanem <gisle.vanem@HIDDEN> Subject: Re: [bug-diffutils] bug#36488: bug#36488: diffutils 3.7 make check failure ppc64le opensuse on colors test To: bug-diffutils@HIDDEN References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> <10257051.elIQoDPIPK@popigai> <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> Message-ID: <0b916f46-2495-3f86-b27d-5b151b8bc7f0@HIDDEN> Date: Sun, 29 Aug 2021 13:13:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=gisle.vanem@HIDDEN; helo=mail-lj1-x22a.google.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.437, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) Paul Eggert wrote: > +static signal_handler > +xsignal (int sig, signal_handler func) > +{ > + signal_handler h = signal (sig, func); > + if (h == SIG_ERR) > + pfatal_with_name ("signal"); > + return h; > +} > + On Windows, this causes a "diff --color file1 file2" to exit with "diff.exe signal". How useful. With some added trace-code I found this was for SIGHUP (=1) which is not supported. So I just dropped SIGHUP from the list. -- --gv
bug-diffutils@HIDDEN
:bug#36488
; Package diffutils
.
Full text available.Received: (at 36488-done) by debbugs.gnu.org; 29 Aug 2021 07:22:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 29 03:22:48 2021 Received: from localhost ([127.0.0.1]:55443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mKF9Q-0001VB-15 for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 03:22:48 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mKF9K-0001Ut-9Z for 36488-done <at> debbugs.gnu.org; Sun, 29 Aug 2021 03:22:42 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F0BB9160071; Sun, 29 Aug 2021 00:22:32 -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 iN6NPjbfglo6; Sun, 29 Aug 2021 00:22:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 25259160100; Sun, 29 Aug 2021 00:22:28 -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 PQoocUNRyQwE; Sun, 29 Aug 2021 00:22:27 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C258C160071; Sun, 29 Aug 2021 00:22:27 -0700 (PDT) To: Thiago Jung Bauermann <bauermann@HIDDEN> References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> <10257051.elIQoDPIPK@popigai> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department Subject: Re: [bug-diffutils] bug#36488: diffutils 3.7 make check failure ppc64le opensuse on colors test Message-ID: <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> Date: Sun, 29 Aug 2021 00:22:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <10257051.elIQoDPIPK@popigai> Content-Type: multipart/mixed; boundary="------------C283A678C824E5E9AFF4010F" Content-Language: en-US X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 36488-done Cc: =?UTF-8?B?RnLDqWTDqXJpYyBCb25uYXJk?= <frediz@HIDDEN>, 922552@HIDDEN, Santiago Vila <sanvila@HIDDEN>, 36488-done <at> debbugs.gnu.org, Normand <normand@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.4 (---) This is a multi-part message in MIME format. --------------C283A678C824E5E9AFF4010F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 8/28/21 8:40 AM, Thiago Jung Bauermann via bug-diffutils via All=20 diffutils discussion. wrote: > I believe this is the same problem reported in bug 34519. > The Debian build also fails with "diff: standard output: Broken pipe". Thanks for tracking that down. Fr=C3=A9d=C3=A9ric's analysis in=20 <https://bugs.debian.org/922552#19> was helpful. I found some time to look into this bug, and installed into=20 Savannah.gnu.org diffutils the attached patch, which I hope fixes the=20 bug although I don't have the relevant platform to test it. Please give=20 it a try. Once this patch is part of a release, Debian shouldn't need any patches=20 for diffutils. For now I am closing the diffutils bug report=20 <https://bugs.gnu.org/36488>; if I was too optimistic and the patch=20 doesn't fix things we can always reopen it. --------------C283A678C824E5E9AFF4010F Content-Type: text/x-patch; charset=UTF-8; name="0001-diff-cleanup-signal-handling-just-before-exit.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-diff-cleanup-signal-handling-just-before-exit.patch" =46rom 9b20182d48481c7ca647ff8926feeb8e1da4f7b0 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@HIDDEN> Date: Sat, 28 Aug 2021 23:49:32 -0700 Subject: [PATCH] diff: cleanup signal handling just before exit MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit This should fix an unlikely signal handling bug with colored output, and should also fix a Debian FTBFS (Fails To Build From Source) on powerpc64le-linux. See Bug#34519 and Fr=C3=A9d=C3=A9ric Bonnard=E2=80=99s report in: https://bugs.debian.org/922552#19 * bootstrap.conf (gnulib_modules): Add raise, sigprocmask. * src/diff.c (main): Call cleanup_signal_handlers before exiting. Don=E2=80=99t bother calling =E2=80=98exit=E2=80=99; no longer needed now= adays. * src/util.c (sigprocmask, siginterrupt) [!SA_NOCLDSTOP]: Define to 0 instead of empty, since the results are now used. (sigset_t) [!SA_NOCLDSTOP]: Remove; we now rely on Gnulib. (xsigaction) [SA_NOCLDSTOP]: New function. (xsigaddset, xsigismember, xsignal, xsigprocmask): New functions. (some_signals_caught): New static var. (process_signals): Omit a conditional branch. Don=E2=80=99t bother loading interrupt_signal if stop_signal_count is non= zero. (process_signals, install_signal_handlers): Check for failures from sigprocmask etc. (sig, nsig): Now at top level, since multiple functions need them. (install_signal_handlers): No need for caught_sig array; just use caught_signals. However, set some_signals_caught. (cleanup_signal_handlers): New function. --- bootstrap.conf | 2 + src/diff.c | 2 +- src/diff.h | 1 + src/util.c | 187 ++++++++++++++++++++++++++++++++----------------- 4 files changed, 127 insertions(+), 65 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index 6560e9a..e51b2d8 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -65,11 +65,13 @@ mktime nstrftime progname propername +raise rawmemchr readme-release regex sh-quote signal +sigprocmask stat stat-macros stat-time diff --git a/src/diff.c b/src/diff.c index a4e5538..3b901aa 100644 --- a/src/diff.c +++ b/src/diff.c @@ -853,7 +853,7 @@ main (int argc, char **argv) print_message_queue (); =20 check_stdout (); - exit (exit_status); + cleanup_signal_handlers (); return exit_status; } =20 diff --git a/src/diff.h b/src/diff.h index 03f00a6..f346b43 100644 --- a/src/diff.h +++ b/src/diff.h @@ -388,6 +388,7 @@ extern struct change *find_change (struct change *); extern struct change *find_reverse_change (struct change *); extern enum changes analyze_hunk (struct change *, lin *, lin *, lin *, = lin *); extern void begin_output (void); +extern void cleanup_signal_handlers (void); extern void debug_script (struct change *); extern void fatal (char const *) __attribute__((noreturn)); extern void finish_output (void); diff --git a/src/util.c b/src/util.c index dd6d3bf..8e676c8 100644 --- a/src/util.c +++ b/src/util.c @@ -31,10 +31,9 @@ present. */ #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 -# define sigprocmask(How, Set, Oset) /* empty */ -# define sigset_t int +# define sigprocmask(How, Set, Oset) 0 # if ! HAVE_SIGINTERRUPT -# define siginterrupt(sig, flag) /* empty */ +# define siginterrupt(sig, flag) 0 # endif #endif =20 @@ -160,16 +159,63 @@ print_message_queue (void) } } =0C -/* The set of signals that are caught. */ =20 +#if SA_NOCLDSTOP +static void +xsigaction (int sig, struct sigaction const *restrict act, + struct sigaction *restrict oact) +{ + if (sigaction (sig, act, oact) !=3D 0) + pfatal_with_name ("sigaction"); +} +#endif + +static void +xsigaddset (sigset_t *set, int sig) +{ + if (sigaddset (set, sig) !=3D 0) + pfatal_with_name ("sigaddset"); +} + +static bool +xsigismember (sigset_t const *set, int sig) +{ + int mem =3D sigismember (set, sig); + if (mem < 0) + pfatal_with_name ("sigismember"); + assume (mem =3D=3D 1); + return mem; +} + +typedef void (*signal_handler) (int); +static signal_handler +xsignal (int sig, signal_handler func) +{ + signal_handler h =3D signal (sig, func); + if (h =3D=3D SIG_ERR) + pfatal_with_name ("signal"); + return h; +} + +static void +xsigprocmask (int how, sigset_t const *restrict set, sigset_t *restrict = oset) +{ + if (sigprocmask (how, set, oset) !=3D 0) + pfatal_with_name ("sigprocmask"); +} + +/* If true, some signals are caught. This is separate from + 'caught_signals' because POSIX doesn't require an all-zero sigset_t + to be valid. */ +static bool some_signals_caught; + +/* The set of signals that are caught. */ static sigset_t caught_signals; =20 /* If nonzero, the value of the pending fatal signal. */ - static sig_atomic_t volatile interrupt_signal; =20 /* A count of the number of pending stop signals that have been received= =2E */ - static sig_atomic_t volatile stop_signal_count; =20 /* An ordinary signal was received; arrange for the program to exit. */= @@ -202,21 +248,17 @@ stophandler (int sig) static void process_signals (void) { - while (interrupt_signal || stop_signal_count) + while (interrupt_signal | stop_signal_count) { - int sig; - int stops; - sigset_t oldset; - set_color_context (RESET_CONTEXT); fflush (stdout); =20 - sigprocmask (SIG_BLOCK, &caught_signals, &oldset); + sigset_t oldset; + xsigprocmask (SIG_BLOCK, &caught_signals, &oldset); =20 - /* Reload interrupt_signal and stop_signal_count, in case a new - signal was handled before sigprocmask took effect. */ - sig =3D interrupt_signal; - stops =3D stop_signal_count; + /* Reload stop_signal_count and (if needed) interrupt_signal, in + case a new signal was handled before sigprocmask took effect. */ + int stops =3D stop_signal_count, sig; =20 /* SIGTSTP is special, since the application can receive that sign= al more than once. In this case, don't set the signal handler to = the @@ -227,82 +269,99 @@ process_signals (void) sig =3D SIGSTOP; } else - signal (sig, SIG_DFL); + { + sig =3D interrupt_signal; + xsignal (sig, SIG_DFL); + } =20 /* Exit or suspend the program. */ - raise (sig); - sigprocmask (SIG_SETMASK, &oldset, NULL); + if (raise (sig) !=3D 0) + pfatal_with_name ("raise"); + xsigprocmask (SIG_SETMASK, &oldset, NULL); =20 /* If execution reaches here, then the program has been continued (after being suspended). */ } } =20 -static void -install_signal_handlers (void) -{ - /* The signals that are trapped, and the number of such signals. */ - static int const sig[] =3D - { - /* This one is handled specially. */ - SIGTSTP, +/* The signals that can be caught, the number of such signals, + and which of them are actually caught. */ +static int const sig[] =3D + { + /* This one is handled specially. */ + SIGTSTP, =20 - /* The usual suspects. */ - SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, + /* The usual suspects. */ + SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, #ifdef SIGPOLL - SIGPOLL, + SIGPOLL, #endif #ifdef SIGPROF - SIGPROF, + SIGPROF, #endif #ifdef SIGVTALRM - SIGVTALRM, + SIGVTALRM, #endif #ifdef SIGXCPU - SIGXCPU, + SIGXCPU, #endif #ifdef SIGXFSZ - SIGXFSZ, + SIGXFSZ, #endif - }; - enum { nsigs =3D sizeof (sig) / sizeof *(sig) }; + }; +enum { nsigs =3D sizeof (sig) / sizeof *(sig) }; + +static void +install_signal_handlers (void) +{ + if (sigemptyset (&caught_signals) !=3D 0) + pfatal_with_name ("sigemptyset"); =20 -#if ! SA_NOCLDSTOP - bool caught_sig[nsigs]; -#endif - { - int j; #if SA_NOCLDSTOP - struct sigaction act; + for (int j =3D 0; j < nsigs; j++) + { + struct sigaction actj; + xsigaction (sig[j], NULL, &actj); + if (actj.sa_handler !=3D SIG_IGN) + xsigaddset (&caught_signals, sig[j]); + } =20 - sigemptyset (&caught_signals); - for (j =3D 0; j < nsigs; j++) + struct sigaction act; + act.sa_mask =3D caught_signals; + act.sa_flags =3D SA_RESTART; + + for (int j =3D 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) { - sigaction (sig[j], NULL, &act); - if (act.sa_handler !=3D SIG_IGN) - sigaddset (&caught_signals, sig[j]); + act.sa_handler =3D sig[j] =3D=3D SIGTSTP ? stophandler : sighandler; + xsigaction (sig[j], &act, NULL); + some_signals_caught =3D true; } - - act.sa_mask =3D caught_signals; - act.sa_flags =3D SA_RESTART; - - for (j =3D 0; j < nsigs; j++) - if (sigismember (&caught_signals, sig[j])) - { - act.sa_handler =3D sig[j] =3D=3D SIGTSTP ? stophandler : sigha= ndler; - sigaction (sig[j], &act, NULL); - } #else - for (j =3D 0; j < nsigs; j++) + for (int j =3D 0; j < nsigs; j++) + if (xsignal (sig[j], SIG_IGN) !=3D SIG_IGN) { - caught_sig[j] =3D (signal (sig[j], SIG_IGN) !=3D SIG_IGN); - if (caught_sig[j]) - { - signal (sig[j], sig[j] =3D=3D SIGTSTP ? stophandler : sighan= dler); - siginterrupt (sig[j], 0); - } + xsigaddset (&caught_signals, sig[j]); + xsignal (sig[j], sig[j] =3D=3D SIGTSTP ? stophandler : sighandler); + some_signals_caught =3D true; + if (siginterrupt (sig[j], 0) !=3D 0) + pfatal_with_name ("siginterrupt"); } #endif +} + +/* Clean up signal handlers just before exiting the program. Do this + by resetting signal actions back to default, and then processing + any signals that arrived before resetting. */ +void +cleanup_signal_handlers (void) +{ + if (some_signals_caught) + { + for (int j =3D 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) + xsignal (sig[j], SIG_DFL); + process_signals (); } } =20 --=20 2.30.2 --------------C283A678C824E5E9AFF4010F--
Santiago Vila <sanvila@HIDDEN>
:Paul Eggert <eggert@HIDDEN>
:Received: (at 36488-done) by debbugs.gnu.org; 29 Aug 2021 07:22:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 29 03:22:48 2021 Received: from localhost ([127.0.0.1]:55443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mKF9Q-0001VB-15 for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 03:22:48 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mKF9K-0001Ut-9Z for 36488-done <at> debbugs.gnu.org; Sun, 29 Aug 2021 03:22:42 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F0BB9160071; Sun, 29 Aug 2021 00:22:32 -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 iN6NPjbfglo6; Sun, 29 Aug 2021 00:22:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 25259160100; Sun, 29 Aug 2021 00:22:28 -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 PQoocUNRyQwE; Sun, 29 Aug 2021 00:22:27 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C258C160071; Sun, 29 Aug 2021 00:22:27 -0700 (PDT) To: Thiago Jung Bauermann <bauermann@HIDDEN> References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> <10257051.elIQoDPIPK@popigai> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department Subject: Re: [bug-diffutils] bug#36488: diffutils 3.7 make check failure ppc64le opensuse on colors test Message-ID: <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> Date: Sun, 29 Aug 2021 00:22:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <10257051.elIQoDPIPK@popigai> Content-Type: multipart/mixed; boundary="------------C283A678C824E5E9AFF4010F" Content-Language: en-US X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 36488-done Cc: =?UTF-8?B?RnLDqWTDqXJpYyBCb25uYXJk?= <frediz@HIDDEN>, 922552@HIDDEN, Santiago Vila <sanvila@HIDDEN>, 36488-done <at> debbugs.gnu.org, Normand <normand@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.4 (---) This is a multi-part message in MIME format. --------------C283A678C824E5E9AFF4010F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 8/28/21 8:40 AM, Thiago Jung Bauermann via bug-diffutils via All=20 diffutils discussion. wrote: > I believe this is the same problem reported in bug 34519. > The Debian build also fails with "diff: standard output: Broken pipe". Thanks for tracking that down. Fr=C3=A9d=C3=A9ric's analysis in=20 <https://bugs.debian.org/922552#19> was helpful. I found some time to look into this bug, and installed into=20 Savannah.gnu.org diffutils the attached patch, which I hope fixes the=20 bug although I don't have the relevant platform to test it. Please give=20 it a try. Once this patch is part of a release, Debian shouldn't need any patches=20 for diffutils. For now I am closing the diffutils bug report=20 <https://bugs.gnu.org/36488>; if I was too optimistic and the patch=20 doesn't fix things we can always reopen it. --------------C283A678C824E5E9AFF4010F Content-Type: text/x-patch; charset=UTF-8; name="0001-diff-cleanup-signal-handling-just-before-exit.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-diff-cleanup-signal-handling-just-before-exit.patch" =46rom 9b20182d48481c7ca647ff8926feeb8e1da4f7b0 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@HIDDEN> Date: Sat, 28 Aug 2021 23:49:32 -0700 Subject: [PATCH] diff: cleanup signal handling just before exit MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit This should fix an unlikely signal handling bug with colored output, and should also fix a Debian FTBFS (Fails To Build From Source) on powerpc64le-linux. See Bug#34519 and Fr=C3=A9d=C3=A9ric Bonnard=E2=80=99s report in: https://bugs.debian.org/922552#19 * bootstrap.conf (gnulib_modules): Add raise, sigprocmask. * src/diff.c (main): Call cleanup_signal_handlers before exiting. Don=E2=80=99t bother calling =E2=80=98exit=E2=80=99; no longer needed now= adays. * src/util.c (sigprocmask, siginterrupt) [!SA_NOCLDSTOP]: Define to 0 instead of empty, since the results are now used. (sigset_t) [!SA_NOCLDSTOP]: Remove; we now rely on Gnulib. (xsigaction) [SA_NOCLDSTOP]: New function. (xsigaddset, xsigismember, xsignal, xsigprocmask): New functions. (some_signals_caught): New static var. (process_signals): Omit a conditional branch. Don=E2=80=99t bother loading interrupt_signal if stop_signal_count is non= zero. (process_signals, install_signal_handlers): Check for failures from sigprocmask etc. (sig, nsig): Now at top level, since multiple functions need them. (install_signal_handlers): No need for caught_sig array; just use caught_signals. However, set some_signals_caught. (cleanup_signal_handlers): New function. --- bootstrap.conf | 2 + src/diff.c | 2 +- src/diff.h | 1 + src/util.c | 187 ++++++++++++++++++++++++++++++++----------------- 4 files changed, 127 insertions(+), 65 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index 6560e9a..e51b2d8 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -65,11 +65,13 @@ mktime nstrftime progname propername +raise rawmemchr readme-release regex sh-quote signal +sigprocmask stat stat-macros stat-time diff --git a/src/diff.c b/src/diff.c index a4e5538..3b901aa 100644 --- a/src/diff.c +++ b/src/diff.c @@ -853,7 +853,7 @@ main (int argc, char **argv) print_message_queue (); =20 check_stdout (); - exit (exit_status); + cleanup_signal_handlers (); return exit_status; } =20 diff --git a/src/diff.h b/src/diff.h index 03f00a6..f346b43 100644 --- a/src/diff.h +++ b/src/diff.h @@ -388,6 +388,7 @@ extern struct change *find_change (struct change *); extern struct change *find_reverse_change (struct change *); extern enum changes analyze_hunk (struct change *, lin *, lin *, lin *, = lin *); extern void begin_output (void); +extern void cleanup_signal_handlers (void); extern void debug_script (struct change *); extern void fatal (char const *) __attribute__((noreturn)); extern void finish_output (void); diff --git a/src/util.c b/src/util.c index dd6d3bf..8e676c8 100644 --- a/src/util.c +++ b/src/util.c @@ -31,10 +31,9 @@ present. */ #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 -# define sigprocmask(How, Set, Oset) /* empty */ -# define sigset_t int +# define sigprocmask(How, Set, Oset) 0 # if ! HAVE_SIGINTERRUPT -# define siginterrupt(sig, flag) /* empty */ +# define siginterrupt(sig, flag) 0 # endif #endif =20 @@ -160,16 +159,63 @@ print_message_queue (void) } } =0C -/* The set of signals that are caught. */ =20 +#if SA_NOCLDSTOP +static void +xsigaction (int sig, struct sigaction const *restrict act, + struct sigaction *restrict oact) +{ + if (sigaction (sig, act, oact) !=3D 0) + pfatal_with_name ("sigaction"); +} +#endif + +static void +xsigaddset (sigset_t *set, int sig) +{ + if (sigaddset (set, sig) !=3D 0) + pfatal_with_name ("sigaddset"); +} + +static bool +xsigismember (sigset_t const *set, int sig) +{ + int mem =3D sigismember (set, sig); + if (mem < 0) + pfatal_with_name ("sigismember"); + assume (mem =3D=3D 1); + return mem; +} + +typedef void (*signal_handler) (int); +static signal_handler +xsignal (int sig, signal_handler func) +{ + signal_handler h =3D signal (sig, func); + if (h =3D=3D SIG_ERR) + pfatal_with_name ("signal"); + return h; +} + +static void +xsigprocmask (int how, sigset_t const *restrict set, sigset_t *restrict = oset) +{ + if (sigprocmask (how, set, oset) !=3D 0) + pfatal_with_name ("sigprocmask"); +} + +/* If true, some signals are caught. This is separate from + 'caught_signals' because POSIX doesn't require an all-zero sigset_t + to be valid. */ +static bool some_signals_caught; + +/* The set of signals that are caught. */ static sigset_t caught_signals; =20 /* If nonzero, the value of the pending fatal signal. */ - static sig_atomic_t volatile interrupt_signal; =20 /* A count of the number of pending stop signals that have been received= =2E */ - static sig_atomic_t volatile stop_signal_count; =20 /* An ordinary signal was received; arrange for the program to exit. */= @@ -202,21 +248,17 @@ stophandler (int sig) static void process_signals (void) { - while (interrupt_signal || stop_signal_count) + while (interrupt_signal | stop_signal_count) { - int sig; - int stops; - sigset_t oldset; - set_color_context (RESET_CONTEXT); fflush (stdout); =20 - sigprocmask (SIG_BLOCK, &caught_signals, &oldset); + sigset_t oldset; + xsigprocmask (SIG_BLOCK, &caught_signals, &oldset); =20 - /* Reload interrupt_signal and stop_signal_count, in case a new - signal was handled before sigprocmask took effect. */ - sig =3D interrupt_signal; - stops =3D stop_signal_count; + /* Reload stop_signal_count and (if needed) interrupt_signal, in + case a new signal was handled before sigprocmask took effect. */ + int stops =3D stop_signal_count, sig; =20 /* SIGTSTP is special, since the application can receive that sign= al more than once. In this case, don't set the signal handler to = the @@ -227,82 +269,99 @@ process_signals (void) sig =3D SIGSTOP; } else - signal (sig, SIG_DFL); + { + sig =3D interrupt_signal; + xsignal (sig, SIG_DFL); + } =20 /* Exit or suspend the program. */ - raise (sig); - sigprocmask (SIG_SETMASK, &oldset, NULL); + if (raise (sig) !=3D 0) + pfatal_with_name ("raise"); + xsigprocmask (SIG_SETMASK, &oldset, NULL); =20 /* If execution reaches here, then the program has been continued (after being suspended). */ } } =20 -static void -install_signal_handlers (void) -{ - /* The signals that are trapped, and the number of such signals. */ - static int const sig[] =3D - { - /* This one is handled specially. */ - SIGTSTP, +/* The signals that can be caught, the number of such signals, + and which of them are actually caught. */ +static int const sig[] =3D + { + /* This one is handled specially. */ + SIGTSTP, =20 - /* The usual suspects. */ - SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, + /* The usual suspects. */ + SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, #ifdef SIGPOLL - SIGPOLL, + SIGPOLL, #endif #ifdef SIGPROF - SIGPROF, + SIGPROF, #endif #ifdef SIGVTALRM - SIGVTALRM, + SIGVTALRM, #endif #ifdef SIGXCPU - SIGXCPU, + SIGXCPU, #endif #ifdef SIGXFSZ - SIGXFSZ, + SIGXFSZ, #endif - }; - enum { nsigs =3D sizeof (sig) / sizeof *(sig) }; + }; +enum { nsigs =3D sizeof (sig) / sizeof *(sig) }; + +static void +install_signal_handlers (void) +{ + if (sigemptyset (&caught_signals) !=3D 0) + pfatal_with_name ("sigemptyset"); =20 -#if ! SA_NOCLDSTOP - bool caught_sig[nsigs]; -#endif - { - int j; #if SA_NOCLDSTOP - struct sigaction act; + for (int j =3D 0; j < nsigs; j++) + { + struct sigaction actj; + xsigaction (sig[j], NULL, &actj); + if (actj.sa_handler !=3D SIG_IGN) + xsigaddset (&caught_signals, sig[j]); + } =20 - sigemptyset (&caught_signals); - for (j =3D 0; j < nsigs; j++) + struct sigaction act; + act.sa_mask =3D caught_signals; + act.sa_flags =3D SA_RESTART; + + for (int j =3D 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) { - sigaction (sig[j], NULL, &act); - if (act.sa_handler !=3D SIG_IGN) - sigaddset (&caught_signals, sig[j]); + act.sa_handler =3D sig[j] =3D=3D SIGTSTP ? stophandler : sighandler; + xsigaction (sig[j], &act, NULL); + some_signals_caught =3D true; } - - act.sa_mask =3D caught_signals; - act.sa_flags =3D SA_RESTART; - - for (j =3D 0; j < nsigs; j++) - if (sigismember (&caught_signals, sig[j])) - { - act.sa_handler =3D sig[j] =3D=3D SIGTSTP ? stophandler : sigha= ndler; - sigaction (sig[j], &act, NULL); - } #else - for (j =3D 0; j < nsigs; j++) + for (int j =3D 0; j < nsigs; j++) + if (xsignal (sig[j], SIG_IGN) !=3D SIG_IGN) { - caught_sig[j] =3D (signal (sig[j], SIG_IGN) !=3D SIG_IGN); - if (caught_sig[j]) - { - signal (sig[j], sig[j] =3D=3D SIGTSTP ? stophandler : sighan= dler); - siginterrupt (sig[j], 0); - } + xsigaddset (&caught_signals, sig[j]); + xsignal (sig[j], sig[j] =3D=3D SIGTSTP ? stophandler : sighandler); + some_signals_caught =3D true; + if (siginterrupt (sig[j], 0) !=3D 0) + pfatal_with_name ("siginterrupt"); } #endif +} + +/* Clean up signal handlers just before exiting the program. Do this + by resetting signal actions back to default, and then processing + any signals that arrived before resetting. */ +void +cleanup_signal_handlers (void) +{ + if (some_signals_caught) + { + for (int j =3D 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) + xsignal (sig[j], SIG_DFL); + process_signals (); } } =20 --=20 2.30.2 --------------C283A678C824E5E9AFF4010F--
Santiago Vila <sanvila@HIDDEN>
:Paul Eggert <eggert@HIDDEN>
:Received: (at 36488-done) by debbugs.gnu.org; 29 Aug 2021 07:22:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 29 03:22:48 2021 Received: from localhost ([127.0.0.1]:55443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mKF9Q-0001VB-15 for submit <at> debbugs.gnu.org; Sun, 29 Aug 2021 03:22:48 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mKF9K-0001Ut-9Z for 36488-done <at> debbugs.gnu.org; Sun, 29 Aug 2021 03:22:42 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F0BB9160071; Sun, 29 Aug 2021 00:22:32 -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 iN6NPjbfglo6; Sun, 29 Aug 2021 00:22:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 25259160100; Sun, 29 Aug 2021 00:22:28 -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 PQoocUNRyQwE; Sun, 29 Aug 2021 00:22:27 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C258C160071; Sun, 29 Aug 2021 00:22:27 -0700 (PDT) To: Thiago Jung Bauermann <bauermann@HIDDEN> References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> <10257051.elIQoDPIPK@popigai> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department Subject: Re: [bug-diffutils] bug#36488: diffutils 3.7 make check failure ppc64le opensuse on colors test Message-ID: <3a207779-c39f-55c0-2f27-d675da6df96f@HIDDEN> Date: Sun, 29 Aug 2021 00:22:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <10257051.elIQoDPIPK@popigai> Content-Type: multipart/mixed; boundary="------------C283A678C824E5E9AFF4010F" Content-Language: en-US X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 36488-done Cc: =?UTF-8?B?RnLDqWTDqXJpYyBCb25uYXJk?= <frediz@HIDDEN>, 922552@HIDDEN, Santiago Vila <sanvila@HIDDEN>, 36488-done <at> debbugs.gnu.org, Normand <normand@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.4 (---) This is a multi-part message in MIME format. --------------C283A678C824E5E9AFF4010F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 8/28/21 8:40 AM, Thiago Jung Bauermann via bug-diffutils via All=20 diffutils discussion. wrote: > I believe this is the same problem reported in bug 34519. > The Debian build also fails with "diff: standard output: Broken pipe". Thanks for tracking that down. Fr=C3=A9d=C3=A9ric's analysis in=20 <https://bugs.debian.org/922552#19> was helpful. I found some time to look into this bug, and installed into=20 Savannah.gnu.org diffutils the attached patch, which I hope fixes the=20 bug although I don't have the relevant platform to test it. Please give=20 it a try. Once this patch is part of a release, Debian shouldn't need any patches=20 for diffutils. For now I am closing the diffutils bug report=20 <https://bugs.gnu.org/36488>; if I was too optimistic and the patch=20 doesn't fix things we can always reopen it. --------------C283A678C824E5E9AFF4010F Content-Type: text/x-patch; charset=UTF-8; name="0001-diff-cleanup-signal-handling-just-before-exit.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-diff-cleanup-signal-handling-just-before-exit.patch" =46rom 9b20182d48481c7ca647ff8926feeb8e1da4f7b0 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@HIDDEN> Date: Sat, 28 Aug 2021 23:49:32 -0700 Subject: [PATCH] diff: cleanup signal handling just before exit MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit This should fix an unlikely signal handling bug with colored output, and should also fix a Debian FTBFS (Fails To Build From Source) on powerpc64le-linux. See Bug#34519 and Fr=C3=A9d=C3=A9ric Bonnard=E2=80=99s report in: https://bugs.debian.org/922552#19 * bootstrap.conf (gnulib_modules): Add raise, sigprocmask. * src/diff.c (main): Call cleanup_signal_handlers before exiting. Don=E2=80=99t bother calling =E2=80=98exit=E2=80=99; no longer needed now= adays. * src/util.c (sigprocmask, siginterrupt) [!SA_NOCLDSTOP]: Define to 0 instead of empty, since the results are now used. (sigset_t) [!SA_NOCLDSTOP]: Remove; we now rely on Gnulib. (xsigaction) [SA_NOCLDSTOP]: New function. (xsigaddset, xsigismember, xsignal, xsigprocmask): New functions. (some_signals_caught): New static var. (process_signals): Omit a conditional branch. Don=E2=80=99t bother loading interrupt_signal if stop_signal_count is non= zero. (process_signals, install_signal_handlers): Check for failures from sigprocmask etc. (sig, nsig): Now at top level, since multiple functions need them. (install_signal_handlers): No need for caught_sig array; just use caught_signals. However, set some_signals_caught. (cleanup_signal_handlers): New function. --- bootstrap.conf | 2 + src/diff.c | 2 +- src/diff.h | 1 + src/util.c | 187 ++++++++++++++++++++++++++++++++----------------- 4 files changed, 127 insertions(+), 65 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index 6560e9a..e51b2d8 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -65,11 +65,13 @@ mktime nstrftime progname propername +raise rawmemchr readme-release regex sh-quote signal +sigprocmask stat stat-macros stat-time diff --git a/src/diff.c b/src/diff.c index a4e5538..3b901aa 100644 --- a/src/diff.c +++ b/src/diff.c @@ -853,7 +853,7 @@ main (int argc, char **argv) print_message_queue (); =20 check_stdout (); - exit (exit_status); + cleanup_signal_handlers (); return exit_status; } =20 diff --git a/src/diff.h b/src/diff.h index 03f00a6..f346b43 100644 --- a/src/diff.h +++ b/src/diff.h @@ -388,6 +388,7 @@ extern struct change *find_change (struct change *); extern struct change *find_reverse_change (struct change *); extern enum changes analyze_hunk (struct change *, lin *, lin *, lin *, = lin *); extern void begin_output (void); +extern void cleanup_signal_handlers (void); extern void debug_script (struct change *); extern void fatal (char const *) __attribute__((noreturn)); extern void finish_output (void); diff --git a/src/util.c b/src/util.c index dd6d3bf..8e676c8 100644 --- a/src/util.c +++ b/src/util.c @@ -31,10 +31,9 @@ present. */ #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 -# define sigprocmask(How, Set, Oset) /* empty */ -# define sigset_t int +# define sigprocmask(How, Set, Oset) 0 # if ! HAVE_SIGINTERRUPT -# define siginterrupt(sig, flag) /* empty */ +# define siginterrupt(sig, flag) 0 # endif #endif =20 @@ -160,16 +159,63 @@ print_message_queue (void) } } =0C -/* The set of signals that are caught. */ =20 +#if SA_NOCLDSTOP +static void +xsigaction (int sig, struct sigaction const *restrict act, + struct sigaction *restrict oact) +{ + if (sigaction (sig, act, oact) !=3D 0) + pfatal_with_name ("sigaction"); +} +#endif + +static void +xsigaddset (sigset_t *set, int sig) +{ + if (sigaddset (set, sig) !=3D 0) + pfatal_with_name ("sigaddset"); +} + +static bool +xsigismember (sigset_t const *set, int sig) +{ + int mem =3D sigismember (set, sig); + if (mem < 0) + pfatal_with_name ("sigismember"); + assume (mem =3D=3D 1); + return mem; +} + +typedef void (*signal_handler) (int); +static signal_handler +xsignal (int sig, signal_handler func) +{ + signal_handler h =3D signal (sig, func); + if (h =3D=3D SIG_ERR) + pfatal_with_name ("signal"); + return h; +} + +static void +xsigprocmask (int how, sigset_t const *restrict set, sigset_t *restrict = oset) +{ + if (sigprocmask (how, set, oset) !=3D 0) + pfatal_with_name ("sigprocmask"); +} + +/* If true, some signals are caught. This is separate from + 'caught_signals' because POSIX doesn't require an all-zero sigset_t + to be valid. */ +static bool some_signals_caught; + +/* The set of signals that are caught. */ static sigset_t caught_signals; =20 /* If nonzero, the value of the pending fatal signal. */ - static sig_atomic_t volatile interrupt_signal; =20 /* A count of the number of pending stop signals that have been received= =2E */ - static sig_atomic_t volatile stop_signal_count; =20 /* An ordinary signal was received; arrange for the program to exit. */= @@ -202,21 +248,17 @@ stophandler (int sig) static void process_signals (void) { - while (interrupt_signal || stop_signal_count) + while (interrupt_signal | stop_signal_count) { - int sig; - int stops; - sigset_t oldset; - set_color_context (RESET_CONTEXT); fflush (stdout); =20 - sigprocmask (SIG_BLOCK, &caught_signals, &oldset); + sigset_t oldset; + xsigprocmask (SIG_BLOCK, &caught_signals, &oldset); =20 - /* Reload interrupt_signal and stop_signal_count, in case a new - signal was handled before sigprocmask took effect. */ - sig =3D interrupt_signal; - stops =3D stop_signal_count; + /* Reload stop_signal_count and (if needed) interrupt_signal, in + case a new signal was handled before sigprocmask took effect. */ + int stops =3D stop_signal_count, sig; =20 /* SIGTSTP is special, since the application can receive that sign= al more than once. In this case, don't set the signal handler to = the @@ -227,82 +269,99 @@ process_signals (void) sig =3D SIGSTOP; } else - signal (sig, SIG_DFL); + { + sig =3D interrupt_signal; + xsignal (sig, SIG_DFL); + } =20 /* Exit or suspend the program. */ - raise (sig); - sigprocmask (SIG_SETMASK, &oldset, NULL); + if (raise (sig) !=3D 0) + pfatal_with_name ("raise"); + xsigprocmask (SIG_SETMASK, &oldset, NULL); =20 /* If execution reaches here, then the program has been continued (after being suspended). */ } } =20 -static void -install_signal_handlers (void) -{ - /* The signals that are trapped, and the number of such signals. */ - static int const sig[] =3D - { - /* This one is handled specially. */ - SIGTSTP, +/* The signals that can be caught, the number of such signals, + and which of them are actually caught. */ +static int const sig[] =3D + { + /* This one is handled specially. */ + SIGTSTP, =20 - /* The usual suspects. */ - SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, + /* The usual suspects. */ + SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, #ifdef SIGPOLL - SIGPOLL, + SIGPOLL, #endif #ifdef SIGPROF - SIGPROF, + SIGPROF, #endif #ifdef SIGVTALRM - SIGVTALRM, + SIGVTALRM, #endif #ifdef SIGXCPU - SIGXCPU, + SIGXCPU, #endif #ifdef SIGXFSZ - SIGXFSZ, + SIGXFSZ, #endif - }; - enum { nsigs =3D sizeof (sig) / sizeof *(sig) }; + }; +enum { nsigs =3D sizeof (sig) / sizeof *(sig) }; + +static void +install_signal_handlers (void) +{ + if (sigemptyset (&caught_signals) !=3D 0) + pfatal_with_name ("sigemptyset"); =20 -#if ! SA_NOCLDSTOP - bool caught_sig[nsigs]; -#endif - { - int j; #if SA_NOCLDSTOP - struct sigaction act; + for (int j =3D 0; j < nsigs; j++) + { + struct sigaction actj; + xsigaction (sig[j], NULL, &actj); + if (actj.sa_handler !=3D SIG_IGN) + xsigaddset (&caught_signals, sig[j]); + } =20 - sigemptyset (&caught_signals); - for (j =3D 0; j < nsigs; j++) + struct sigaction act; + act.sa_mask =3D caught_signals; + act.sa_flags =3D SA_RESTART; + + for (int j =3D 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) { - sigaction (sig[j], NULL, &act); - if (act.sa_handler !=3D SIG_IGN) - sigaddset (&caught_signals, sig[j]); + act.sa_handler =3D sig[j] =3D=3D SIGTSTP ? stophandler : sighandler; + xsigaction (sig[j], &act, NULL); + some_signals_caught =3D true; } - - act.sa_mask =3D caught_signals; - act.sa_flags =3D SA_RESTART; - - for (j =3D 0; j < nsigs; j++) - if (sigismember (&caught_signals, sig[j])) - { - act.sa_handler =3D sig[j] =3D=3D SIGTSTP ? stophandler : sigha= ndler; - sigaction (sig[j], &act, NULL); - } #else - for (j =3D 0; j < nsigs; j++) + for (int j =3D 0; j < nsigs; j++) + if (xsignal (sig[j], SIG_IGN) !=3D SIG_IGN) { - caught_sig[j] =3D (signal (sig[j], SIG_IGN) !=3D SIG_IGN); - if (caught_sig[j]) - { - signal (sig[j], sig[j] =3D=3D SIGTSTP ? stophandler : sighan= dler); - siginterrupt (sig[j], 0); - } + xsigaddset (&caught_signals, sig[j]); + xsignal (sig[j], sig[j] =3D=3D SIGTSTP ? stophandler : sighandler); + some_signals_caught =3D true; + if (siginterrupt (sig[j], 0) !=3D 0) + pfatal_with_name ("siginterrupt"); } #endif +} + +/* Clean up signal handlers just before exiting the program. Do this + by resetting signal actions back to default, and then processing + any signals that arrived before resetting. */ +void +cleanup_signal_handlers (void) +{ + if (some_signals_caught) + { + for (int j =3D 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) + xsignal (sig[j], SIG_DFL); + process_signals (); } } =20 --=20 2.30.2 --------------C283A678C824E5E9AFF4010F--
Normand <normand@HIDDEN>
:Paul Eggert <eggert@HIDDEN>
:Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 36488) by debbugs.gnu.org; 28 Aug 2021 15:40:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 28 11:40:50 2021 Received: from localhost ([127.0.0.1]:54848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mK0Ru-0006V0-9q for submit <at> debbugs.gnu.org; Sat, 28 Aug 2021 11:40:50 -0400 Received: from mx.kolabnow.com ([95.128.36.42]:57168) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <bauermann@HIDDEN>) id 1mK0Rs-0006Um-Ih for 36488 <at> debbugs.gnu.org; Sat, 28 Aug 2021 11:40:49 -0400 Received: from localhost (unknown [127.0.0.1]) by ext-mx-out002.mykolab.com (Postfix) with ESMTP id 7C1F91254; Sat, 28 Aug 2021 17:40:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:date:subject:subject :from:from:received:received:received; s=dkim20160331; t= 1630165242; x=1631979643; bh=7GWIBuB1SDjphGGF+lZc/7MRKvABnEavbPa ZnXNvS1M=; b=rCTBs/Ub0Crg+hbPOn171KRAlK76LkyF9bDnzGKAvccKDNe3a9E OmMmTUh9ASBIsQzjWxXLIMf6/r4AP6Sq6wxdEGIFhfR49jN1CCuAF8SbaoODZl1h bxJhQ+yxo2g4Lwe9nRKhdrK+LTCqZuyeyMDhAqSK48bMm9pW45VjiHlPSaIAV3eL CNJ32H0xnouFZ//53oCxEl1OdFXTzVLAdeKTXrJ2gPvdTDYotItSfk66czVVqZMg 4Jbq1x9mo9kSHIkntYbka3dIOTm1fbyO3+1aXPKofTWHFts0HSiC1Y8MO7pwKTmD GfeaXNWKElPCEIskFUBkanO8Oe0mEDqHKZOBb0AZpCHPvFbsyxcu72mRZDgp6KEv ZkDVYmiFeMzKcMZ2/p6EazIMNOd53P6edXdetaFOKG5GkRT+Yqkqkcyfb0sIrh+R j+YzzbMdvdGoiyyP0m4TzJh23Z9jlCrxFDILyvUfDyNuTYnHK+9yPJ/zcnTbeN3k ein9u8nvIipc+GyGIfYbVitQiQMpvGJNpOb/bNz5zq++UxZi2GSNFOE+fPNRSO8A yj2ckPwxAUgHNtxA5ekdNFWrh7FTvHsOuKsroU8AlLqBgRuEiQPyWX1k6JKJDQf5 2BjgZcOrLTlu0/0Kf9u7K8VHWvtjr18qqez+npmnX+fmAAhinjYrSfjE= X-Virus-Scanned: amavisd-new at mykolab.com X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-10 required=5 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out002.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bx0d52jHE2hu; Sat, 28 Aug 2021 17:40:42 +0200 (CEST) Received: from int-mx002.mykolab.com (unknown [10.9.13.2]) by ext-mx-out002.mykolab.com (Postfix) with ESMTPS id E7EDD51E; Sat, 28 Aug 2021 17:40:41 +0200 (CEST) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx002.mykolab.com (Postfix) with ESMTPS id 7BB76363D; Sat, 28 Aug 2021 17:40:40 +0200 (CEST) From: Thiago Jung Bauermann <bauermann@HIDDEN> To: 36488 <at> debbugs.gnu.org Subject: Re: diffutils 3.7 make check failure ppc64le opensuse on colors test Date: Sat, 28 Aug 2021 12:40:35 -0300 Message-ID: <10257051.elIQoDPIPK@popigai> In-Reply-To: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> References: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36488 Cc: Normand <normand@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Em quarta-feira, 3 de julho de 2019, =E0s 08:19:55 -03, Normand escreveu: > diffutils 3.7 make check failure ppc64le opensuse on colors test as > reported in OBS tool (1) >=20 >=20 > The extracted failure is a "Broken pipe" I believe this is the same problem reported in bug 34519. The Debian build also fails with "diff: standard output: Broken pipe". =2D-=20 Thanks, Thiago
bug-diffutils@HIDDEN
:bug#36488
; Package diffutils
.
Full text available.Received: (at submit) by debbugs.gnu.org; 3 Jul 2019 11:20:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 03 07:20:15 2019 Received: from localhost ([127.0.0.1]:48467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1hidJ8-0002MR-IJ for submit <at> debbugs.gnu.org; Wed, 03 Jul 2019 07:20:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:34692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <normand@HIDDEN>) id 1hidJ7-0002MK-0B for submit <at> debbugs.gnu.org; Wed, 03 Jul 2019 07:20:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35818) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from <normand@HIDDEN>) id 1hidJ5-0004Xw-KH for bug-diffutils@HIDDEN; Wed, 03 Jul 2019 07:20: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=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW, TVD_SUBJ_NUM_OBFU_MINFP,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <normand@HIDDEN>) id 1hidJ3-0003Fd-Pm for bug-diffutils@HIDDEN; Wed, 03 Jul 2019 07:20:11 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:18094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <normand@HIDDEN>) id 1hidJ1-00036l-OK for bug-diffutils@HIDDEN; Wed, 03 Jul 2019 07:20:09 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x63BHuHt038022 for <bug-diffutils@HIDDEN>; Wed, 3 Jul 2019 07:20:02 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tgs8jwjnw-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for <bug-diffutils@HIDDEN>; Wed, 03 Jul 2019 07:20:01 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for <bug-diffutils@HIDDEN> from <normand@HIDDEN>; Wed, 3 Jul 2019 12:19:59 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 3 Jul 2019 12:19:57 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x63BJuPi50593926 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for <bug-diffutils@HIDDEN>; Wed, 3 Jul 2019 11:19:56 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 156ED52050 for <bug-diffutils@HIDDEN>; Wed, 3 Jul 2019 11:19:56 +0000 (GMT) Received: from [9.134.167.79] (unknown [9.134.167.79]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id EDB475204E for <bug-diffutils@HIDDEN>; Wed, 3 Jul 2019 11:19:55 +0000 (GMT) To: bug-diffutils@HIDDEN From: Normand <normand@HIDDEN> Subject: diffutils 3.7 make check failure ppc64le opensuse on colors test Date: Wed, 3 Jul 2019 13:19:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19070311-0016-0000-0000-0000028EC3A1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19070311-0017-0000-0000-000032EC5C26 Message-Id: <bf6471bb-38a2-d0a9-aee4-e20edb86fc97@HIDDEN> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-03_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=752 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907030136 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) diffutils 3.7 make check failure ppc64le opensuse on colors test as reported in OBS tool (1) The extracted failure is a "Broken pipe" ``` [ 185s] XFAIL: large-subopt [ 185s] PASS: new-file [ 185s] PASS: no-dereference [ 186s] PASS: no-newline-at-eof [ 186s] PASS: stdin [ 186s] PASS: strcoll-0-names [ 186s] PASS: filename-quoting [ 187s] strip-trailing-cr: skipped test: requires a working valgrind [ 187s] SKIP: strip-trailing-cr [ 187s] FAIL: colors [ 187s] ============================================= [ 187s] GNU diffutils 3.7: tests/test-suite.log [ 187s] ============================================= [ 187s] [ 187s] # TOTAL: 22 [ 187s] # PASS: 19 [ 187s] # SKIP: 1 [ 187s] # XFAIL: 1 [ 187s] # FAIL: 1 [ 187s] # XPASS: 0 [ 187s] # ERROR: 0 ... [ 187s] FAIL: colors [ 187s] ============ ... [ 187s] + compare exp out [ 187s] + compare_dev_null_ exp out [ 187s] + test 2 = 2 [ 187s] + test xexp = x/dev/null [ 187s] + test xout = x/dev/null [ 187s] + return 2 [ 187s] + case $? in [ 187s] + compare_ exp out [ 187s] + diff -u exp out [ 187s] + mkfifo fifo [ 187s] + printf %1000000s-a [ 187s] + printf %1000000s-b [ 187s] + diff --color=always ---presume-output-tty a b [ 187s] + head -c 10 [ 187s] diff: standard output: Broken pipe [ 187s] + test 2 = 141 [ 187s] + fail=1 [ 187s] + Exit 1 ``` (1) https://build.opensuse.org/package/live_build_log/home:michel_mno:branches:Base:System/diffutils/openSUSE_Factory_PowerPC/ppc64le -- Michel Normand
Normand <normand@HIDDEN>
:bug-diffutils@HIDDEN
.
Full text available.bug-diffutils@HIDDEN
:bug#36488
; Package diffutils
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.