From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id A37936DE144B for ; Mon, 10 Jun 2019 04:20:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 2.052 X-Spam-Level: ** X-Spam-Status: No, score=2.052 tagged_above=-999 required=5 tests=[AWL=-0.051, DATE_IN_PAST_12_24=0.804, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zv3CuIg5gkXf for ; Mon, 10 Jun 2019 04:20:39 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id 0DA296DE0F4E for ; Mon, 10 Jun 2019 04:20:36 -0700 (PDT) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019; t=1560165635; h=from : to : subject : in-reply-to : references : date : message-id : mime-version : content-type : from; bh=2hkWwn2dAWXRGe413YQfx48pdV/iASv3aOYFKqKo4mo=; b=wGE2b9bCU+D8LneL8ssFWXCk+XpaEpb1ZMRmsVe8jQ/tR4FA11kUXi6q bmHoVXOKNUZjiID262y9Xw8M3LrPAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019rsa; t=1560165635; h=from : to : subject : in-reply-to : references : date : message-id : mime-version : content-type : from; bh=2hkWwn2dAWXRGe413YQfx48pdV/iASv3aOYFKqKo4mo=; b=RDgJzhjj07Ugfh5aeUD2OX+MUsxrUJRXDJmpws7Se1fUO804jNhBoKsR jg/N74C7ANtpfCepwroaQqVtETFyUA20NGR9lU4Sq8nN/S1fzjlb7G3HCy 3o+BQMGXnmZDvLJhRVCi3j/SOZZKtSNZmScopZ4h4wtkf2oKty4bK5lzBL S+rDuI1O6owuCPsvtdtXQyVitinG9fxgdwmYRwLtBEUabKHCaN4IeNaVno bzs902ZyY0EbzCKdBRweJIFeQIRMR9R+KSc/v3zDlt/goo+jx3F7lYDau7 M2zC3EhidSlPAoUyuLQC7MtET6AXm/Zp1adw/499ASaFf8Kwe7M2Hw== Received: from fifthhorseman.net (unknown [41.226.24.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by che.mayfirst.org (Postfix) with ESMTPSA id 574E1F9A8; Mon, 10 Jun 2019 07:20:34 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id AE2CE207E9; Sun, 9 Jun 2019 16:14:39 -0400 (EDT) From: Daniel Kahn Gillmor To: Tomi Ollila , notmuch@notmuchmail.org Subject: Re: [PATCH] test: aggregate-results.sh: consistent style. zero forks. In-Reply-To: <20190604194624.15102-1-tomi.ollila@iki.fi> References: <20190604194624.15102-1-tomi.ollila@iki.fi> Autocrypt: addr=dkg@fifthhorseman.net; prefer-encrypt=mutual; keydata= mDMEXEK/AhYJKwYBBAHaRw8BAQdAr/gSROcn+6m8ijTN0DV9AahoHGafy52RRkhCZVwxhEe0K0Rh bmllbCBLYWhuIEdpbGxtb3IgPGRrZ0BmaWZ0aGhvcnNlbWFuLm5ldD6ImQQTFggAQQIbAQUJA8Jn AAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgBYhBMS8Lds4zOlkhevpwvIGkReQOOXGBQJcQsbzAhkB AAoJEPIGkReQOOXG4fkBAO1joRxqAZY57PjdzGieXLpluk9RkWa3ufkt3YUVEpH/AP9c+pgIxtyW +FwMQRjlqljuj8amdN4zuEqaCy4hhz/1DbgzBFxCv4sWCSsGAQQB2kcPAQEHQERSZxSPmgtdw6nN u7uxY7bzb9TnPrGAOp9kClBLRwGfiPUEGBYIACYWIQTEvC3bOMzpZIXr6cLyBpEXkDjlxgUCXEK/ iwIbAgUJAeEzgACBCRDyBpEXkDjlxnYgBBkWCAAdFiEEyQ5tNiAKG5IqFQnndhgZZSmuX/gFAlxC v4sACgkQdhgZZSmuX/iVWgD/fCU4ONzgy8w8UCHGmrmIZfDvdhg512NIBfx+Mz9ls5kA/Rq97vz4 z48MFuBdCuu0W/fVqVjnY7LN5n+CQJwGC0MIA7QA/RyY7Sz2gFIOcrns0RpoHr+3WI+won3xCD8+ sVXSHZvCAP98HCjDnw/b0lGuCR7coTXKLIM44/LFWgXAdZjm1wjODbg4BFxCv50SCisGAQQBl1UB BQEBB0BG4iXnHX/fs35NWKMWQTQoRI7oiAUt0wJHFFJbomxXbAMBCAeIfgQYFggAJhYhBMS8Lds4 zOlkhevpwvIGkReQOOXGBQJcQr+dAhsMBQkB4TOAAAoJEPIGkReQOOXGe/cBAPlek5d9xzcXUn/D kY6jKmxe26CTws3ZkbK6Aa5Ey/qKAP0VuPQSCRxA7RKfcB/XrEphfUFkraL06Xn/xGwJ+D0hCw== Date: Sun, 09 Jun 2019 16:14:39 -0400 Message-ID: <87blz6plcg.fsf@fifthhorseman.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2019 11:20:39 -0000 --=-=-= Content-Type: text/plain On Tue 2019-06-04 22:46:24 +0300, Tomi Ollila wrote: > - all variables in $((...)) without leading $ > - all comparisons use -gt, -eq or -ne > - no -a nor -o inside [ ... ] expressions > - all indentation levels using one tab > > Dropped unnecessary empty string check when reading results files. > > Replaced pluralize() which was executed in subshell with > pluralize_s(). pluralize_s sets $s to 's' or '' based on value of > $1. Calls to pluralize_s are done in context of current shell, so > no forks to subshells executed. I'm fine with all these changes, but: > -if [ "$fixed" = "0" ] && [ "$failed" = "0" ]; then > +if [ $fixed -eq 0 ] && [ $failed -eq 0 ]; then I think we've set $fixed and $failed above to a non-empty string value, so this is technically correct. But the shell programmer nit-picker in me gets nervous seeing any variable used inside a test without proper wrapping, and i'm going to have trouble adopting $foo instead of "$foo" in other shell scripts. it seems to require a lot of global reasoning about the state of a given variable to use it without quotes safely, and it introduces some subtle requirements (like, no unsetting these variables and no setting them to the empty string). So anyway, i don't see the harm in using "$foo" instead in this case, and it seems like it actually reduces the cognitive burden of maintiaining the code. i'm happy to listen to any compelling story yo've got for why this is an important change, but i'd prefer to avoid it. (i don't at all mind unwrapping "0" to 0 though) thanks for doing this cleanup! --dkg --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQTJDm02IAobkioVCed2GBllKa5f+AUCXP1orwAKCRB2GBllKa5f +DeXAQDoA8HONLr5Gcv1QHnr9cuSDfvt7TQIxT1V58B9Y96eUQD/SkxvIOAmRN7/ nltKV+z3ppiE6dVYyVyT3F+nmco9yQk= =v/Vd -----END PGP SIGNATURE----- --=-=-=--