Ludovic Courtès <ludo@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 62406) by debbugs.gnu.org; 23 Mar 2023 18:54:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 23 14:54:09 2023 Received: from localhost ([127.0.0.1]:39326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1pfQ4f-0001nn-GB for submit <at> debbugs.gnu.org; Thu, 23 Mar 2023 14:54:09 -0400 Received: from mout02.posteo.de ([185.67.36.66]:42331) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <bavier@HIDDEN>) id 1pfQ4d-0001nI-4h for 62406 <at> debbugs.gnu.org; Thu, 23 Mar 2023 14:54:07 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 2C133240117 for <62406 <at> debbugs.gnu.org>; Thu, 23 Mar 2023 19:53:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679597641; bh=y/CdelC0B23AOx4bXxwxqezjXQ3Aoo8qTqM4BC4wweo=; h=Subject:From:To:Date:From; b=YUVjlTGCH8s1qVJhte8jMOQf9LhjGdzUYS0ud/eN2FGWxHbb75kR8/4xELDdo+vow FWpMdLMnIxYZlDHwrP16XJuZMLw6Oe9Eie0qvv/+9KmZfzNnhOXL8ofj8ryEuT2J5m CsVDPYOUGZZVlPgFF+bMwjDrIpwCj2UgtCLgd/rbtuRmEvH+/H7nmR+sJWnBTI5lFA 5jfsVwj1YevMdddxV/NOIANDQT1dFaH6r1+mt/aHEj3VICfUf0Kkzlm7HqgVxIH4/e DJVOJ12YYn7XJFY8PAff5mmlM4G/Olb5BR8F3oq6JrfDnPLccVxggDgOtn66k7erod euJECDaOjaYug== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PjDyY596tz9rxK; Thu, 23 Mar 2023 19:53:57 +0100 (CET) Message-ID: <75622c7ab52087a4266b7b48374013d0c76d3c53.camel@HIDDEN> Subject: Re: bug#62406: =?UTF-8?Q?=E2=80=9C!?= =?UTF-8?Q?_failing-command=E2=80=9D?= pattern in shell tests is wrong From: Eric Bavier <bavier@HIDDEN> To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>, 62406 <at> debbugs.gnu.org Date: Thu, 23 Mar 2023 18:53:47 +0000 In-Reply-To: <87y1nn790x.fsf@HIDDEN> References: <87y1nn790x.fsf@HIDDEN> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-6HegMgacj7HYq038+RdR" MIME-Version: 1.0 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62406 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 (---) --=-6HegMgacj7HYq038+RdR Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2023-03-23 at 17:00 +0100, Ludovic Court=C3=A8s wrote: > In <https://issues.guix.gnu.org/43616> (commit > d8934360d2453a403b5433e71d09188e4ed23b57), we changed: >=20 > if command that should fail; then false; else true; fi >=20 > to: >=20 > ! command that should fail >=20 > I had reservations back then, and now I know why: :-) >=20 > --8<---------------cut here---------------start------------->8--- > $ bash -xe -c '! true; true' > + true > + true > $ echo $? > 0 > $ bash -xe -c '! false; true' > + false > + true > $ echo $? > 0 > --8<---------------cut here---------------end--------------->8--- >=20 > Whether or not the command following the exclamation mark succeeds, the > statement succeeds. Bummer. I think it's maybe not that the statement succeeds regardless. But that 's= et -e' doesn't consider it a "failure". From "The Set Builtin": '-e' Exit immediately if a pipeline (*note Pipelines::)... returns a non-zero status. The shell does not exit if the command that fails is ..., or if the command's return status is being inverted with '!'. So in each of your examples, execution continues to the second 'true' statement and the overall exit status is 0. This is not the behavior we wa= nt in our tests. The purpose of d89343 was to ease visual parsing of the tests. I mentioned having used the '!' syntax in my own shell tests, but I realize now that I was not relying on `set -e` like guix is. I'll consider a few options. Do we have a known issue where this is causin= g a test to not to catch a failure? Thanks for bringing this up, `~Eric --=-6HegMgacj7HYq038+RdR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQJGBAABCgAwFiEEo6S0GQB0CHyn3laYvEXKZ+L40AcFAmQcoDsSHGJhdmllckBw b3N0ZW8ubmV0AAoJELxFymfi+NAH2CMP/iEDMDJBkmTHzQ7IZuMvUHTuY3bSRrKY ux0xPoeCN+jsRr/11qhsIJnvcTAjXzfM8n+7/a5cRHVJZqrB5yN7PNvfs5jXu53l wzT4fx7LrfzttEbdubT/7oARGsCA528DC1tcP2HZRTFpichMwxRlQlUJuRZd74E8 3I3XTXApfh+FQBShkNRXU22BkMv2csv3qaXkkJIifnYM9BtvjB7Z7ATuNh8JLJXW qg/Yu0xZ2us9ya8/0SEPJ9PvWJ3bMCVpEVPSxFPdeupAqTXjKI5F6BSoJsXaRKC0 I3YCRXS+ab9l8Un31tdJz3Vu6NbsLQ31pHqHe3/ipUb6crTxxfV+myLI0hHcNKQB F1YCMSoBuz+hmSHxIYDLGEZHF2xENbz9a434pCriJoV3GS+FxxyqYLHKPgvhe94w SgLupMfKpZlj6P9+dHs0YdS1nAjZ7K5/rGYa1ecTh5ghw/hMJO7sLCVq442OjSTn +5xm74fwsDqDRigi7psyjvdKM3GuhPcHZ9oTzs5ShiwzHFhps55JV4DS1xMx2n9F iDG57EtwtGOHDGo6D/mrJ21RMTPe8Elyd7z4bWb633e0KjElQSOFTSSnJMpZbs3N j5KKSnw8tXk2bSk8oNjmCf6Hcf7sksfOzP/vbkJxbQpXlSdNOo5KZOfYdXOfFkTr mZsPoPM29Hv8 =g1CF -----END PGP SIGNATURE----- --=-6HegMgacj7HYq038+RdR--
bug-guix@HIDDEN
:bug#62406
; Package guix
.
Full text available.Received: (at submit) by debbugs.gnu.org; 23 Mar 2023 16:00:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 23 12:00:22 2023 Received: from localhost ([127.0.0.1]:39176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1pfNMU-00038M-0y for submit <at> debbugs.gnu.org; Thu, 23 Mar 2023 12:00:22 -0400 Received: from lists.gnu.org ([209.51.188.17]:55014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1pfNMR-00038B-Rg for submit <at> debbugs.gnu.org; Thu, 23 Mar 2023 12:00:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1pfNMR-0007Ta-2G for bug-guix@HIDDEN; Thu, 23 Mar 2023 12:00:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1pfNMQ-0001c0-RS for bug-guix@HIDDEN; Thu, 23 Mar 2023 12:00:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=y5gVdeogxSk1LLby3/BAt5DBtWCoosqz8MmjKhbC1O0=; b=OfwaXipJe224BI UvSuwz4Qm5Q5lmEjzj/hgCmp9x1ZH+z01nF3vIczz1cGuLnF1yT1LPlPYziFyL7A69hyAfGIGCjET wmIR5yjKsg21wmELc/mXJjauk8HskExpBZryMOkz2yecBcEJTR2M3nXHybsAvELLWl5pNoMg7jaVH QJbp97k8l3ZjrjtzcnOh5/rWxR/S2X2SEZui7nWS0LfbDI6eD6pmnzUpKrpb4doywTF9HFABpOz6H cgQT0dbFe/hfMBR0OPzYgbfiFj87EDEUFtp+j44zgB19YloUsR9T+kbtJrc2v0mL/KWWhtKUQ5vYw k3/qRb1Ng+qwREDdlx9g==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1pfNMP-00048H-At for bug-guix@HIDDEN; Thu, 23 Mar 2023 12:00:18 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: bug-guix@HIDDEN Subject: =?utf-8?Q?=E2=80=9C!_failing-command=E2=80=9D?= pattern in shell tests is wrong X-Debbugs-Cc: Eric Bavier <bavier@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Tridi 3 Germinal an 231 de la =?utf-8?Q?R=C3=A9volut?= =?utf-8?Q?ion=2C?= jour de l'Asperge X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 23 Mar 2023 17:00:14 +0100 Message-ID: <87y1nn790x.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) 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 (---) In <https://issues.guix.gnu.org/43616> (commit d8934360d2453a403b5433e71d09188e4ed23b57), we changed: if command that should fail; then false; else true; fi to: ! command that should fail I had reservations back then, and now I know why: :-) --8<---------------cut here---------------start------------->8--- $ bash -xe -c '! true; true' + true + true $ echo $? 0 $ bash -xe -c '! false; true' + false + true $ echo $? 0 --8<---------------cut here---------------end--------------->8--- Whether or not the command following the exclamation mark succeeds, the statement succeeds. Bummer. The Bash manual (info "(bash) Pipelines") reads: If the reserved word '!' precedes the pipeline, the exit status is the logical negation of the exit status as described above. The shell waits for all commands in the pipeline to terminate before returning a value. To me, that means it should work as we thought, but it=E2=80=99s a fact tha= t it doesn=E2=80=99t. Thoughts? Ludo=E2=80=99.
Ludovic Courtès <ludo@HIDDEN>
:bavier@HIDDEN, bug-guix@HIDDEN
.
Full text available.bavier@HIDDEN, bug-guix@HIDDEN
:bug#62406
; Package guix
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.