From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.7 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id A632B1F407 for ; Sun, 10 Dec 2017 14:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751554AbdLJN7s (ORCPT ); Sun, 10 Dec 2017 08:59:48 -0500 Received: from mout.gmx.net ([212.227.15.18]:50314 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbdLJN7r (ORCPT ); Sun, 10 Dec 2017 08:59:47 -0500 Received: from virtualbox ([37.201.193.73]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LqylH-1f21is3bwB-00egFa; Sun, 10 Dec 2017 14:59:45 +0100 Date: Sun, 10 Dec 2017 14:59:45 +0100 (CET) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: =?UTF-8?Q?Torsten_B=C3=B6gershausen?= cc: git@vger.kernel.org Subject: Re: [PATCH v1 1/1] check-non-portable-shell.pl: Quoted `wc -l` is not portable In-Reply-To: <20171210105013.3984-1-tboegi@web.de> Message-ID: References: <20171210105013.3984-1-tboegi@web.de> User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-706629426-1512914385=:4318" X-Provags-ID: V03:K0:JJod2G1+RR52MMNyZ/nz7r5PrAZgS3HVuvx94z9KUZY3Rvd+AUC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weWW9Sr93Y= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-706629426-1512914385=:4318 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Hi Torsten, On Sun, 10 Dec 2017, tboegi@web.de wrote: > From: Torsten B=C3=B6gershausen >=20 > wc -l is used to count the number if lines in test scripts. > $ wc -l Makefile > gives a line like this: > 105 Makefile > while Mac OS has 4 leading spaces: > 105 Makefile >=20 > And this means that shell expressions like > test "$(wc -l =20 > A portable way to use `wc -l` is to omit the '"': > test $(wc -l =20 > Add a check in check-non-portable-shell.pl to find '"' between > `wc -l` and '=3D' >=20 > Signed-off-by: Torsten B=C3=B6gershausen > --- > t/check-non-portable-shell.pl | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.p= l > index 03dc9d2852..9ebf65c26f 100755 > --- a/t/check-non-portable-shell.pl > +++ b/t/check-non-portable-shell.pl > @@ -21,6 +21,7 @@ while (<>) { > =09/^\s*declare\s+/ and err 'arrays/declare not portable'; > =09/^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)= '; > =09/\btest\s+[^=3D]*=3D=3D/ and err '"test a =3D=3D b" is not portable (= please use =3D)'; > +=09/\bwc -l.*"\s*=3D/ and err '`"$(wc -l)"` is not portable, please use = `$(wc -l)`'; > =09/\bexport\s+[A-Za-z0-9_]*=3D/ and err '"export FOO=3Dbar" is not port= able (please use FOO=3Dbar && export FOO)'; > =09# this resets our $. for each file > =09close ARGV if eof; As noted elsewhere, this should suggest `test_line_count` instead. After all, that function is not only guaranteed to stay portable (even if we should ever start supporting systems *without* `wc`), but it also has a semantically-meaningful name worthy of the current century. Ciao, Dscho --8323329-706629426-1512914385=:4318--