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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 2162DC432BE for ; Tue, 31 Aug 2021 09:33:11 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D31AD60F4B for ; Tue, 31 Aug 2021 09:33:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D31AD60F4B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 102DB83390; Tue, 31 Aug 2021 11:33:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="h2Fh669j"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BA5483354; Tue, 31 Aug 2021 11:33:05 +0200 (CEST) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B1FA883335 for ; Tue, 31 Aug 2021 11:32:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=none smtp.helo=mail-ej1-x633.google.com Received: by mail-ej1-x633.google.com with SMTP id u14so37086556ejf.13 for ; Tue, 31 Aug 2021 02:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XBGk1SqCNmNL/1lDdNbVgqt0n9GIWoni7HDQoKHncgA=; b=h2Fh669jzdAYgJKZ6xdp/l0lhjWGTyLXZ+aEmmHmW07CaoHDlxW0vUNEDhD6A12SL8 DIXiBnQQmIbrsFFG2Qrs0Yq7JFV3LDf8k95wK3jCzPOZRdWBI8ORu+XiHLLtB3So7lfy sSZnIj80kPq/iXMqe7pHfmExPn2EK2mVaybPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XBGk1SqCNmNL/1lDdNbVgqt0n9GIWoni7HDQoKHncgA=; b=ABXpNmGYVmwLfGEKs2WdM3mNh39tV6ua0o3oc9gw5Zd/2bUGBokK5+QzqmmYEwct36 U0QQtMZURUxwq1DcP/QQlPoS/YZa2N4xlqcadxY/czD1f70ScIEeIjHDGAGehZ+E3Ww0 fd2jy5BVsGAj3q+PWJ7+Y4ZMwoISb5HdoZogOxkHONGFU1JNphcQ5hOv7MCcjyIiPX9H 0SpdsmmICOZLNtDJplCgdcTMd3j1N3oh+/xKwB33vZVPV29bhuPFy9+dQUp/JMX/jvPJ 5h2JKaoBnZ0hmERCZhblhA7HJuDs/TVvZlcogwui9gI1Cy+INH2OhwmNzl6+SBsj2rS9 7UGA== X-Gm-Message-State: AOAM532hA6OEqn6n7jqN7inasgf0k/bLj0lrYmamjneeSi9FJgKgp8Ui RKgjdR7gRxkfC83Znar0nmGGBw== X-Google-Smtp-Source: ABdhPJwIbNb9GRKDIziOF3QbK7jnkli49BE4uHOPh8Xd8vnngpKOm9qm4/66iKhlNk+aHtEhtgNbwg== X-Received: by 2002:a17:906:a044:: with SMTP id bg4mr30042101ejb.312.1630402379357; Tue, 31 Aug 2021 02:32:59 -0700 (PDT) Received: from pwmachine.localnet ([2a01:cb14:983:1f00:e358:1600:77d9:374f]) by smtp.gmail.com with ESMTPSA id b13sm9036121edu.27.2021.08.31.02.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 02:32:58 -0700 (PDT) From: Francis Laniel To: Wolfgang Denk Cc: u-boot@lists.denx.de, michael@amarulasolutions.com, Marek =?ISO-8859-1?Q?Beh=FAn?= , Simon Glass , hws@denx.de Subject: Re: How should we deal with actual hush odd behavior? Date: Tue, 31 Aug 2021 11:32:56 +0200 Message-ID: <4647124.GXAFRqVoOG@pwmachine> In-Reply-To: <47007.1629717610@gemini.denx.de> References: <2787647.e9J7NaK4W3@pwmachine> <47007.1629717610@gemini.denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi. Le lundi 23 ao=FBt 2021, 13:20:10 CEST Wolfgang Denk a =E9crit : > Dear Francis, >=20 > In message <2787647.e9J7NaK4W3@pwmachine> you wrote: > > Porting 2021 Busybox hush to U-Boot seems, for me, to be a good idea as= we > > would benefit from Busybox bug fixes as well as being compatible with > > actual hush (in theory). > > We could also add new features to U-Boot hush, like functions, as they > > were > > added to Busybox. >=20 > Thanks a lot, much appreciated. >=20 > > Nonetheless, the idea of this port is to be compatible. >=20 > My recommendation is not to try to be bug-compatible, i. e. is the > current U-Boot version of hush behaves different than the recent > one, we should check how other POSIX compatible shells behave. > I would expect that in most cases the old hush in U-Boot has a bug, > which has been fixed in the recent version. >=20 > In such a situation, we should accept the bug fix and not try tokeep > the old, buggy behaviour of the old version. >=20 > > In practice, I noted some cases when this is actually not the case. > > The first one can be related to how && and || operators were handled in > > hush. So, the following: false && false || true > > Returns 0 on Busybox 2021 hush and 1 on U-Boot. > >=20 > > The behavior of 2021 is coherent with the definition of these operators= =20 [4]: > > > The return status of AND and OR lists is the exit > > > status of the last command executed in the list. >=20 > This is a clear bug in the old version. It's good to see it fixed > in the recent code. >=20 > > An other example concerns variable expansion, where foo=3D'bar "quux" is > > expanded to bar quux in U-Boot and bar "quux in Busybox. >=20 > I guess you mean foo=3D'bar "quux' ? [ foo=3D'bar "quux" is > missing the closing apostrophe.] Sorry, I indeed missed the closing apostrophe. >=20 > Again, this is a bug in U-Boots command line parsing. >=20 > > I do not have a real opinion on the second one, as I think local variab= le > > set in U-Boot scripts are quite simple as people do not try to do: > > foo=3D"bar \"quux 'quuz' \"\"\"corge". > > The first one is maybe more problematic. > > Grepping "if test" shows me that the more complex if condition seems to= be > > under the form: > > if first_test_ AND/OR second_test > > Here also, people seems to no try to write complex expression like: foo= || > > bar; echo quux && quuz. >=20 > We should port the recent version of hush without hesitating about > bug compatibility of expected use cases. We can'tknoww if peple > didn't use afeature because the ran into problems with it, or > because it's just not their programming style. >=20 > > So, porting Busybox 2021 hush can solve bugs we have currently in U-Boo= t, > > but what if fixing these bugs lead to a board script failing and so a > > device not booting... >=20 > The new version should be optional in any case, at least for some > longer migration period to give users time to test their scripts. > If someone selects the new version in his board configuration, he > probably has run enough tests to make sure his scripts are working > fine in the new environment. I added a choice in Kconfig to permits user to select the parser they want = to=20 use (either the old or the new one). By default, the old one is selected. More generally, I see it seems to be a consensus over going with the new 20= 21=20 behavior (which contains bug fixes compared to old one) rather than stickin= g=20 with the old (and sometime buggy) behavior. Thank you a lot for all your comments! >=20 > Best regards, >=20 > Wolfgang Denk