From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 4CitDZygHGRdAgEASxT56A (envelope-from ) for ; Thu, 23 Mar 2023 19:55:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id cNnlDJygHGQ6KAEAG6o9tA (envelope-from ) for ; Thu, 23 Mar 2023 19:55:24 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EEC318E99 for ; Thu, 23 Mar 2023 19:55:23 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=YUVjlTGC; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679597724; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=26+QHzF+U/aM6XpYddiadoSBJdY2DKbRBrnIch1YJm4=; b=COTPfK1S9wRtnENuXfaa05aqOe6QRLwNWZmHhY7973Vs97pyvoEX3Dzp6g8kvzVkEgzyMT lugGDRermN1pP+YoIHrQfehK3dM1iGT/sw4VawOZu3qpy2ltelLkbtrNwv0wkjWNc5L6TJ 62JtJN4ZLMn0sLkX+gIh72cVdiHWtF92BUKFgftxgetvmfjZHNvqON7yewQ47acI7BR2Ti fTWQgfbMD2L1k5GtT/xRrOA9kyix/D2hBd0yGJfU/P2t05hYgx9KZ9JXPmcM0hLFSXMCSA EmSXKzriLJ5T62BgnmXk7TqJ8aM7WLBjJ4qnwnQvrsPwsEJnOIgReqSXJNHajw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679597724; a=rsa-sha256; cv=none; b=qavnIYGdXZJuF8v8ZS58wJoZTBv/ZSI2X+lMoLqvUNDoRhnnBHGbBuyAaIdLq5iSOFiuxv 1TlcoDrtlThlh6RGvsw4dJxd5wMcsniLmvTaSNn9wrM9fmDcFPYHI6DRWZ6GdIFmnSdaJX UOwcQUPqIOqnXkM6WgI9GFM5x8m7LPjlZq2mQbSxVZKGFa9rtqarYPIGW/uSBNizcaVkLy bOQFjSY/9A21AsLhmCLF7AQ5mIRPpM5LR858S75XKCmhvvHEYJ9cD8hIOS+vUN7KSBKdA5 Mzfm6FhUztNruvCWfVjCv4wXxsVuEG1GTt9UvRn8LLF/68ocg2spx0/cSCN3sw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=YUVjlTGC; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfQ5a-0005Hz-M1; Thu, 23 Mar 2023 14:55:06 -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 ) id 1pfQ5Y-0005HZ-4D for bug-guix@gnu.org; Thu, 23 Mar 2023 14:55:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pfQ5X-0006gP-8L for bug-guix@gnu.org; Thu, 23 Mar 2023 14:55:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pfQ5W-0001p5-IP for bug-guix@gnu.org; Thu, 23 Mar 2023 14:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#62406: =?UTF-8?Q?=E2=80=9C!_?= =?UTF-8?Q?failing-command=E2=80=9D?= pattern in shell tests is wrong Resent-From: Eric Bavier Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 23 Mar 2023 18:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62406 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 62406@debbugs.gnu.org Received: via spool by 62406-submit@debbugs.gnu.org id=B62406.16795976506935 (code B ref 62406); Thu, 23 Mar 2023 18:55:02 +0000 Received: (at 62406) by debbugs.gnu.org; 23 Mar 2023 18:54:10 +0000 Received: from localhost ([127.0.0.1]:39326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfQ4f-0001nn-GB for submit@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 ) id 1pfQ4d-0001nI-4h for 62406@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@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@posteo.net> From: Eric Bavier Date: Thu, 23 Mar 2023 18:53:47 +0000 In-Reply-To: <87y1nn790x.fsf@inria.fr> References: <87y1nn790x.fsf@inria.fr> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-6HegMgacj7HYq038+RdR" MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: X-Migadu-Queue-Id: EEC318E99 X-Spam-Score: -5.05 X-Migadu-Spam-Score: -5.05 X-Migadu-Scanner: scn0.migadu.com List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: M0VYaKb5yNK2 --=-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 (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--