From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id COspKUCuIGQ7qwAASxT56A (envelope-from ) for ; Sun, 26 Mar 2023 22:42:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MJRtKECuIGSXigAAG6o9tA (envelope-from ) for ; Sun, 26 Mar 2023 22:42:40 +0200 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 70E22325B for ; Sun, 26 Mar 2023 22:42:40 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgXBj-00007G-Ka; Sun, 26 Mar 2023 16:42:03 -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 1pgUuQ-0002iI-G1 for bug-guix@gnu.org; Sun, 26 Mar 2023 14:16:02 -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 1pgUuQ-00065s-7A for bug-guix@gnu.org; Sun, 26 Mar 2023 14:16:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgUuP-0002VA-Te for bug-guix@gnu.org; Sun, 26 Mar 2023 14:16:01 -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: Martin Castillo Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 26 Mar 2023 18:16:01 +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 Cc: Eric Bavier Received: via spool by 62406-submit@debbugs.gnu.org id=B62406.16798545459594 (code B ref 62406); Sun, 26 Mar 2023 18:16:01 +0000 Received: (at 62406) by debbugs.gnu.org; 26 Mar 2023 18:15:45 +0000 Received: from localhost ([127.0.0.1]:45770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgUu9-0002Uf-6Z for submit@debbugs.gnu.org; Sun, 26 Mar 2023 14:15:45 -0400 Received: from mail.uni-bremen.de ([134.102.50.15]:41296 helo=smtp.uni-bremen.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgUu7-0002UQ-CQ for 62406@debbugs.gnu.org; Sun, 26 Mar 2023 14:15:43 -0400 Received: from [192.168.42.32] (ip4d16eb70.dynamic.kabel-deutschland.de [77.22.235.112]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.uni-bremen.de (Postfix) with ESMTPSA id 4Pl3yx2v6nzDCbX; Sun, 26 Mar 2023 20:15:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=uni-bremen.de; s=2019; t=1679854537; bh=7OsNHZjSZE6ts+0kjtUDmIcgCKE2NwIaoCVZjGu0ZuA=; h=Date:To:Cc:References:From:In-Reply-To; b=fGnoMWXo//knE5AEtEKLKOdJ+60V4IIK3JJOSqb0nJyMhwxuMiKZplnba8nNrZAI7 PWgRbH44sgvixS/tMd9nvrrrXk02aJtISZvmb3kvvBqj5/QntcWaBLgwWcsVQxL8IJ qhzSGOqeaV12e/2x2Wo6pjfQijTykEXTYbbMsAq/sq59djldeE5WM8Fjt5F1M/5Baq OjZs16qsoz/tCUFLD4EDvZKUePSH2+81lhlvcMPHRrL6OPg1ky1WHiQ9cLG7zN7a1e /D6C7dtFXk0RYmVfhoVibRWTWKbr5d1+8f68Sh4AN/jev+MKWyjZY/LKROD7hEyZyT MUOomcKaWrcFw== Message-ID: <7d5754f3-86e8-4be5-ccb6-689d4d29a8d7@uni-bremen.de> Date: Sun, 26 Mar 2023 20:16:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: de-DE References: <87y1nn790x.fsf@inria.fr> From: Martin Castillo In-Reply-To: <87y1nn790x.fsf@inria.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Sun, 26 Mar 2023 16:42:01 -0400 X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679863360; a=rsa-sha256; cv=none; b=m0STX3iqmKnj3bKD6QWU1e9lrrE3xj8N+hHwB4cuBj72pgynHkczg/aOSU+qV4LdQn5yty 17h2g95Wupy0nlYMgp3YmQq3T1E6PtBE7EuD1/Qm8lQ3HpOG39PcasHu5g36//oymMwLtD HqssWij2gLuctN1kayZiARKMY7ql+EXhS5KrbuCeSUyLqdm2NOrlMF5VzyDvXNzBPjL/Yd G/OCPtOq3HDxQDMlpCi8jJjvUg+H82kfRfpul40t/F5VC4/fjJy9d26p4O0ytP4ZYqJp5z vZvQeVL55jpzQLlkbDnJujAkIX/PtOYf0bAP4URmmRVyPPeimSPo4lSmdXKYPg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=uni-bremen.de header.s=2019 header.b=fGnoMWXo; dmarc=fail reason="SPF not aligned (relaxed)" header.from=uni-bremen.de (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679863360; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=FMDFnOuEfLPe6UpAjvu31cWflGHYH6yfEqCmB/P0FR8=; b=mDYmFcrku2N5cxN9vJZlg1JU+mr6O0VHuo5Ms51ZKcLB3BfWescvoz5VTUQZ3Ahi3UmBGO B0vFScI7b1rhuP4jOe25Cmr+q3w7c1exVLGw7tyiTmOnMzwp/M5ZvtxwuDx9IIdsmYEwQH p7/WyewBWKpOV30YVNE8v71JoDLXWcqr2q1VIrG0jNFV+XZfGc9/6vp46zr+UAwEuFypGZ sGGXk0kVcHvJ/lY7fm8gULVzs2m9tcX39xO4dPA4zaXeYpqn/0JYZqpZQnm/9WT6Qusnj4 2VKys3CzLomm4OYnh4ftfI4QnJ7ot9N4qSRjnSNVn1qGW47tlplqOi/hhv0r1w== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=uni-bremen.de header.s=2019 header.b=fGnoMWXo; dmarc=fail reason="SPF not aligned (relaxed)" header.from=uni-bremen.de (policy=none); 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" X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -0.83 X-Spam-Score: -0.83 X-Migadu-Queue-Id: 70E22325B X-TUID: thTjZdxb+qiQ Hi, Am 23.03.23 um 17:00 schrieb Ludovic Courtès:> In (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’s a fact that it > doesn’t. the documentation on `-e` says: -e Exit immediately if a pipeline (which may consist of a single simple command), a list, or a compound command (see SHELL GRAMMAR above), exits with a non-zero status. The shell does not exit [...] if the command's return value is being inverted with !. I have no idea what might be the rationale for that.