From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 qMVODGVXOGQVkgAASxT56A (envelope-from ) for ; Thu, 13 Apr 2023 21:26:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sNxDDGVXOGRelwAA9RJhRA (envelope-from ) for ; Thu, 13 Apr 2023 21:26:29 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 82D8884C0 for ; Thu, 13 Apr 2023 21:25:05 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id CD7B25F7ED; Thu, 13 Apr 2023 19:25:02 +0000 (UTC) X-Greylist: delayed 1677 seconds by postgrey-1.36 at yantan; Thu, 13 Apr 2023 19:24:59 UTC Received: from meesny.iki.fi (meesny.iki.fi [IPv6:2001:67c:2b0:1c1::201]) by mail.notmuchmail.org (Postfix) with ESMTPS id 3EF755F771 for ; Thu, 13 Apr 2023 19:24:59 +0000 (UTC) Received: from c53 (gw1.nor.fi [185.218.193.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: too) by meesny.iki.fi (Postfix) with ESMTPSA id 4Py8fc5l4Jzybb; Thu, 13 Apr 2023 22:24:56 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1681413897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BhsXlvLOGzosDlYW71S8q6+ibL6awSpxTXLkvwlYrO4=; b=GjAoT6VmHi68CgC/l+7rEaN8RuRY/IFuo2er8XBmpMd2tNrsndGWW4OuVRpfn/0XvY9bQT eaZkPAdALppBOFRnLS5brUxrdmYy4PV/5UP1E5iT+SEeUxZXOGnB0vN0bg01qgzZ7akfLV LfBSRNVEKuR6OXr09qsT1FvEJgRfBJg= ARC-Seal: i=1; s=meesny; d=iki.fi; t=1681413897; a=rsa-sha256; cv=none; b=VvMgOQFyBBP0yOZGB9XdCggZHfTWdXzQ8eIcT63tWi14GA3dgShfiyew+66bSabj6z1zPr fRCSl+hS6CkKYzBYEveVmOTpHe8ulqjn84fFMdPyUROaUORAqc4nAyR1lyAIt+9Sfifu7S baG31cvzHSTY/s1UvsliRlz1aDOSZ9E= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1681413897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BhsXlvLOGzosDlYW71S8q6+ibL6awSpxTXLkvwlYrO4=; b=xjOn3zuR3TB0/D/VdrPhUfysOr0JTe6BGz0ecji3dqrGjOdeFaUcxdcUE7z2x4sJkn8h6y l2+A7QuLh0WUVPZeZ7Ghk8PJJQ9tVtTCjcvny/0sbSXNp7JQlLl01f315mF516qe9Z4CNd HbcTFSP5+joiCID274z2b54DTRMtGHc= From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH v3 1/5] test: use bash specific test for feature tests In-Reply-To: <20230409142627.2216080-2-david@tethera.net> References: <20230409142627.2216080-1-david@tethera.net> <20230409142627.2216080-2-david@tethera.net> User-Agent: Notmuch/0.37+27~gff8ef59 (https://notmuchmail.org) Emacs/27.1 X-Face: HhBM'cA~ MIME-Version: 1.0 Message-ID-Hash: LYVNLYOMVAEIWWM4SWRRXJRQ4FA72LUB X-Message-ID-Hash: LYVNLYOMVAEIWWM4SWRRXJRQ4FA72LUB X-MailFrom: tomi.ollila@iki.fi X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Seal: i=2; s=key1; d=yhetil.org; t=1681413905; a=rsa-sha256; cv=fail; b=TlgiYXrVZHW37nJAsgzh4pkyIf76ocElpoefJCTwZXBViL0wFAZBsZzYnxXKslj3RNANXJ xGA1B3eO2SMvZY5GA9QVdofB8iKne+bxarWEuQrC6g39HdUHMnP63ovEiD6eIBTx+TsvsZ qQxyvZzeJASpoJpu/cRHOG5RKGnSSNxJa+AZ5BKgNAqRBo1USo0F7jGJXXtN1mnR/bvmZp UUjAt1dTNtWeK16i8LnmJNJedhdKpjTM2wIx4Bi0YlKEgEW/3jAblcKZEYScRgebO+OcLw GfYQO8j1riJY1+Fc9ilLHVr4KIaONR5HyfPJmh42OjZxjpDu/xvbXe1U1xK3/A== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=meesny header.b=GjAoT6Vm; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1681413905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=B1grMn1w2ovj+7Nwt0qpyzAhUZ7K4eDkeg52jl5nDDA=; b=NX3VhKntJuQlCYSJZ2KzOE7L9CJYIOtPhdoDCi9FFsIpNNNxg/o13I8G5OTVZildxnR6FI 2ODA/vU4AdlWtbeEw6mCop2taRVel/RMbQSqxbRvO4GER9g+UYTzugzk2PYmdxeP2Zpaxa /vmNNUmeV4/37x3AjShcoCXpft6Ua6EXJk/DzSG5KsFZGR2y6Fv8Iuq3udTz1BB5fPz4LL NXIDlPDkqF6EU3QlILxWtdsNtU57RrcV/MjBYBvm4C+u16PTv6+l5XmZCrh6pD9kPVcb8B CpI7auaFVPBtpK3L0K2bzBTMTi7jIs9voTHG1tGOGhlZjS0zc4nSuz2PZD769Q== X-Migadu-Queue-Id: 82D8884C0 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=meesny header.b=GjAoT6Vm; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}") X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: 2.44 X-Spam-Score: 2.44 X-TUID: QecaEIuukmq5 On Sun, Apr 09 2023, David Bremner wrote: > It is desirable to have the tests consider these variables being > undefined as equivalent to the feature not being present, and in > particular for the tests not to generate errors. > > We know the test suite is tied to bash anyway, so this is a simple > fix. > --- > test/T060-count.sh | 2 +- > test/T081-sexpr-search.sh | 2 +- > test/T150-tagging.sh | 2 +- > test/T160-json.sh | 2 +- > test/T220-reply.sh | 2 +- > test/T240-dump-restore.sh | 2 +- > test/T391-python-cffi.sh | 3 +-- > test/T392-python-cffi-notmuch.sh | 2 +- > test/T520-show.sh | 2 +- > test/T570-revision-tracking.sh | 2 +- > test/T700-reindex.sh | 2 +- > test/T800-asan.sh | 2 +- > test/T810-tsan.sh | 2 +- > test/T850-git.sh | 2 +- > 14 files changed, 14 insertions(+), 15 deletions(-) > > diff --git a/test/T060-count.sh b/test/T060-count.sh > index 48146706..4499b4cb 100755 > --- a/test/T060-count.sh > +++ b/test/T060-count.sh > @@ -157,7 +157,7 @@ print("4: {} messages".format(query.count_messages())) > EOF > test_expect_equal_file EXPECTED OUTPUT > > -if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then > +if [[ $NOTMUCH_HAVE_SFSEXP -eq 1 ]]; then Hmm, I send reply to Felipe's email, before seeing this, so this is followup ... which, at the end, reaches the same "conclusion" :D anyway, while this is good progress the [[ $v -eq 1 ]] is still somewhat fragile (using -eu shows some interesting behaviors): the easy try: $ bash -eu -c ' [[ $AAA -ne 1 ]] && echo 1 || echo 0' bash: line 1: AAA: unbound variable weirder...: $ bash -eu -c 'a="x"; [[ $a -eq 2 ]]' bash: line 1: x: unbound variable wat, as $a is not numeric, it tries to re-eval $x ??? $ bash -eu -c 'x=3; a="x"; [[ $a -eq 2 ]] && echo 1 || echo 0' 0 $ bash -eu -c 'x=2; a="x"; [[ $a -eq 2 ]] && echo 1 || echo 0' 1 for reference $ bash -eu -c 'a="2"; [[ $a -eq 2 ]] && echo 1 || echo 0' 1 and again, w/ = instead of -eq $ bash -eu -c 'a="x"; [[ $a = 2 ]] && echo 1 || echo 0' 0 and -- modified the first AAA case above: $ bash -eu -c ' AAA=b; [[ ${AAA-} = 1 ]] && echo 1 || echo 0' 0 hmm, when using [[ ]] I recall == and != were to used... uh, see bash manual about the pattern matching and such... tried also with (( ... )) (documenter before [[ ]] in bash manual page but now it fails even heavier..: $ bash -eu -c 'XXX="a"; (( ${XXX-} == 2 )) && echo 1 || echo 0' bash: line 1: a: unbound variable $ bash -eu -c 'a=2; XXX="a"; (( ${XXX-} == 2 )) && echo 1 || echo 0' 1 I would just use [ "${VAR-}" = 1 ] in shell script code (or barely [[ ${VAR-0} == 1 ]] if desired not to have ""s around variables...but...) ... using [ "${VAR-}" = 1 ] is also good in a sense that someone may use it as an example to write shell scripts with #!/bin/sh as a hashbang -- and it works fine on Fedora since there /bin/sh is bash, but would fail on Debian since there /bin/sh is dash. HTH ;D Tomi