From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id A26161F4B4 for ; Mon, 12 Apr 2021 17:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243722AbhDLRm6 convert rfc822-to-8bit (ORCPT ); Mon, 12 Apr 2021 13:42:58 -0400 Received: from mut-mta1-se01b-zose1-fr.yulpa.io ([185.49.22.247]:53937 "EHLO mut-mta1-se01b-zose1-fr.yulpa.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238649AbhDLRm5 (ORCPT ); Mon, 12 Apr 2021 13:42:57 -0400 X-Greylist: delayed 1742 seconds by postgrey-1.27 at vger.kernel.org; Mon, 12 Apr 2021 13:42:57 EDT Received: from [185.217.155.54] (helo=mut-zose1-mta-hub-outweb01a-fr.yulpa.io) by mut-mta1-se01b-fr.yulpa.io with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1lW07o-000Bhu-Dn; Mon, 12 Apr 2021 19:13:29 +0200 Received: from localhost (localhost [127.0.0.1]) by mut-zose1-mta-hub-outweb01a-fr.yulpa.io (Postfix) with ESMTP id 4EE9CC0EAE; Mon, 12 Apr 2021 19:13:22 +0200 (CEST) Received: from mut-zose1-mta-hub-outweb01a-fr.yulpa.io ([127.0.0.1]) by localhost (mut-zose1-mta-hub-outweb01a-fr.yulpa.io [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 8jT93pqSatj2; Mon, 12 Apr 2021 19:13:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mut-zose1-mta-hub-outweb01a-fr.yulpa.io (Postfix) with ESMTP id 759DAC0F04; Mon, 12 Apr 2021 19:13:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at mut-zose1.yulpa.io Received: from mut-zose1-mta-hub-outweb01a-fr.yulpa.io ([127.0.0.1]) by localhost (mut-zose1-mta-hub-outweb01a-fr.yulpa.io [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id r8hkdEvVBQLN; Mon, 12 Apr 2021 19:13:21 +0200 (CEST) Received: from zose-store11.web4all.fr (zose-store11.web4all.fr [10.101.13.41]) by mut-zose1-mta-hub-outweb01a-fr.yulpa.io (Postfix) with ESMTP id 5009EC0EAE; Mon, 12 Apr 2021 19:13:21 +0200 (CEST) Date: Mon, 12 Apr 2021 19:13:21 +0200 (CEST) From: Matthieu Moy To: Eric Sunshine Cc: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Git Mailing List , Junio C Hamano , Jeff King , Johannes Schindelin Message-ID: <926894000.404076765.1618247601502.JavaMail.zimbra@matthieu-moy.fr> In-Reply-To: References: Subject: Re: [PATCH 01/16] check-non-portable-shell: complain about "test" a/-o instead of &&/|| MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Mailer: Zimbra 8.8.15_GA_3980 (ZimbraWebClient - FF87 (Linux)/8.8.15_GA_3980) Thread-Topic: check-non-portable-shell: complain about "test" a/-o instead of &&/|| Thread-Index: 9tRzH2wdTZx0DCwZlic0Zryr4DS2iQ== X-Originating-IP: 185.217.155.54 X-yulPa-Domain: mut-zose1.yulpa.io X-yulPa-Username: 185.217.155.54 Authentication-Results: yulpa.io; auth=pass smtp.auth=185.217.155.54@mut-zose1.yulpa.io X-yulPa-Outgoing-Class: ham X-yulPa-Outgoing-Evidence: Combined (0.17) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMV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bDkGaW6BO7tZNFdnYafys+thEQwN42EcAjvU8saQ hcdg2g/DRIMfIy4vIFFXfOOTpx2HiEeuVlHsplMkkb/VBGfADMfD+gk8ti4OIo3M5Odh9pvot7sH ObaZtbNmimwBtfpphGQUt3zXX1hWATGZlqg99tdRW7E= X-Report-Abuse-To: spam@mut-mta1-se01a-fr.yulpa.io Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "Eric Sunshine" wrote: > On Mon, Apr 12, 2021 at 7:09 AM Ævar Arnfjörð Bjarmason > wrote: > > Expand the t/check-non-portable-shell.pl checks to complain about the > > use of "-a" and "-o" to the "test" shell built-in to to mean "and" and > > "or", as opposed to using two "test" invocations with "&&" or "||". > > There aren't any portability issues with using that construct that I > > know of, but since Junio expressed a dislike of it in [1] and we've > > currently got no such constructs let's add it to the lint checking. I > > had various in-flight and WIP patches that used this construct. > It's not only Junio's dislike of `-a` and `-o` but also that they have > long been considered obsolescent by POSIX[1]. GNU has likewise warned > against it[2] for a few decades. > [1]: > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_16 > [2]: > https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Limitations-of-Builtins.html And also in Git's Documentation/CodingGuidelines, which motivates the advice with an example: test -n "$x" -a "$a" = "$b" is buggy and breaks when $x is "=", but test -n "$x" && test "$a" = "$b" does not have such a problem. -- Matthieu Moy https://matthieu-moy.fr/