From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4C7DC433DB for ; Mon, 15 Mar 2021 23:10:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EDC964F5C for ; Mon, 15 Mar 2021 23:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232400AbhCOXK2 (ORCPT ); Mon, 15 Mar 2021 19:10:28 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:50430 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbhCOXKI (ORCPT ); Mon, 15 Mar 2021 19:10:08 -0400 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1lLwLP-00061Y-RR; Tue, 16 Mar 2021 10:09:52 +1100 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Tue, 16 Mar 2021 10:09:51 +1100 Date: Tue, 16 Mar 2021 10:09:51 +1100 From: Herbert Xu To: Linus Torvalds Cc: Rong Chen , kernel test robot , Peter Oberparleiter , Andrew Morton , kbuild-all@lists.01.org, Linux Kernel Mailing List Subject: Re: [kbuild-all] Re: [PATCH] gcov: fail build on gcov_info size mismatch Message-ID: <20210315230951.GA17229@gondor.apana.org.au> References: <20210311130328.2859337-1-oberpar@linux.ibm.com> <202103120329.VU4uJ0yZ-lkp@intel.com> <09373c3d-73e8-933a-24ad-5c4ba4fdc615@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 15, 2021 at 01:57:58PM -0700, Linus Torvalds wrote: > > $ [ "!" = ".size" -a "b" = ".LPBX0," ] > > causes > > dash: 6: [: =: unexpected operator > > because for some reason that "-a" ends up (wild handwaving here about > what is going on) re-parsing the first expression, and ignoring the > quoting around "!" when it does so. The quoting on "!" doesn't help I'm afraid. Even though [ is a built-in it is not allowed to look at the quoting because it's supposed to behave in the same way whether you get the builtin [ or the one from /usr/bin. So when it gets the expression the quoting on the "!" has already been removed. IOW this expression is ambiguous and may or may not fail depending on how it's parsed. Note that when you have a simple expression like [ "!" = ".size" ] special rules come into play on how it is parsed: https://pubs.opengroup.org/onlinepubs/009604499/utilities/test.html But this does not apply when you construct more complex ones with -a. There are two ways around this when writing scripts, you either add something to ensure that "!" cannot occur, e.g., [ "X$a" = "X$b" -a ... ] or you break it down into a simpler expression that is guaranteed by POSIX: [ "$a" = "$b" ] && [ ... ] Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7416755717125107185==" MIME-Version: 1.0 From: Herbert Xu To: kbuild-all@lists.01.org Subject: Re: [PATCH] gcov: fail build on gcov_info size mismatch Date: Tue, 16 Mar 2021 10:09:51 +1100 Message-ID: <20210315230951.GA17229@gondor.apana.org.au> In-Reply-To: List-Id: --===============7416755717125107185== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Mon, Mar 15, 2021 at 01:57:58PM -0700, Linus Torvalds wrote: > > $ [ "!" =3D ".size" -a "b" =3D ".LPBX0," ] > = > causes > = > dash: 6: [: =3D: unexpected operator > = > because for some reason that "-a" ends up (wild handwaving here about > what is going on) re-parsing the first expression, and ignoring the > quoting around "!" when it does so. The quoting on "!" doesn't help I'm afraid. Even though [ is a built-in it is not allowed to look at the quoting because it's supposed to behave in the same way whether you get the builtin [ or the one from /usr/bin. So when it gets the expression the quoting on the "!" has already been removed. IOW this expression is ambiguous and may or may not fail depending on how it's parsed. Note that when you have a simple expression like [ "!" =3D ".size" ] special rules come into play on how it is parsed: https://pubs.opengroup.org/onlinepubs/009604499/utilities/test.html But this does not apply when you construct more complex ones with -a. There are two ways around this when writing scripts, you either add something to ensure that "!" cannot occur, e.g., [ "X$a" =3D "X$b" -a ... ] or you break it down into a simpler expression that is guaranteed by POSIX: [ "$a" =3D "$b" ] && [ ... ] Cheers, -- = Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt --===============7416755717125107185==--