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 8FAECC4338F for ; Mon, 23 Aug 2021 11:20:26 +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 A9A906138E for ; Mon, 23 Aug 2021 11:20:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A9A906138E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de 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 D4A2D8314F; Mon, 23 Aug 2021 13:20:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1629717624; bh=JE34jBtoNp9SHlhQUsOXadIBhHspclA5KBX/+jKlJLk=; h=To:cc:From:Subject:In-reply-to:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JurML2p8zRQDNv43L3Gr1z8QuXQ5CXcFUyckTagzgcmxvEYjcD1wa5tjz5TukeaF6 WM8tMbKLoTQ6ZiBu5gpi7f6yoGE0Pb1HdrKEjz0h+N7s39sDovX6RyHhHE2fqBcz+8 YZ+Ytr6Y7DG39iUV7H2xsOhAMKhBp+I5TfBv+7UE+peWc7Vc0oMBLScFD8PI8yyltt B3ABoFSoEaxBADRLgV7xFk0Ojh4TFDbcPBBY/KoLOYUgxtj0Pg91gFD91DgeNlhK70 8fBiIKx+ClfPeLTzjQd0qPJjxlVea+knwTxif0eA7ShMEcjcXQ/FMQb7nEBzpyZT/i DsyP3MI/FzrkQ== Received: from janitor.denx.de (unknown [62.91.23.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id AEFC1831E7 for ; Mon, 23 Aug 2021 13:20:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1629717620; bh=JE34jBtoNp9SHlhQUsOXadIBhHspclA5KBX/+jKlJLk=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=OV56KhWprTlctk2XcNuJxQ4epsy28d4kYku/Zntpg0+lb7NheZjtd8mjEbrmEltoo sQaNKH0jqqhvfT2ureb0e5s7li8e0EnkGs172WsBHCWmWbjIw9JHmQtbJir/inXuiS wvVttAGdcY/m4SJ7v6Ks117WY82f9GzNWhxfukWTBpRDDkoZOOoqt5xEmD3ElJdyTR MS0CsWTdUNAT3HhpWdTeKuuIsH975NizyW9u/CUhCksw4CYU4K5UOBcGkogvVUFLr0 C6E5kMFsuf+JIKinvhGUoNAeEUWu8DynBnud9cSTugfAlfJ/WIzB4HTuurZZeTBAEr FULcJI4yMIlhA== Received: by janitor.denx.de (Postfix, from userid 108) id 5BF6AA0228; Mon, 23 Aug 2021 13:20:20 +0200 (CEST) Received: from gemini.denx.de (gemini.denx.de [10.4.0.2]) by janitor.denx.de (Postfix) with ESMTPS id 6D6ABA003B; Mon, 23 Aug 2021 13:20:10 +0200 (CEST) Received: from gemini.denx.de (localhost [IPv6:::1]) by gemini.denx.de (Postfix) with ESMTP id 2FAB71E1E46; Mon, 23 Aug 2021 13:20:10 +0200 (CEST) To: Francis Laniel cc: u-boot@lists.denx.de, michael@amarulasolutions.com, Marek =?ISO-8859-1?Q?Beh=FAn?= , Simon Glass , hws@denx.de From: Wolfgang Denk Subject: Re: How should we deal with actual hush odd behavior? MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit In-reply-to: <2787647.e9J7NaK4W3@pwmachine> References: <2787647.e9J7NaK4W3@pwmachine> Comments: In-reply-to Francis Laniel message dated "Fri, 20 Aug 2021 18:12:23 +0200." Date: Mon, 23 Aug 2021 13:20:10 +0200 Message-ID: <47007.1629717610@gemini.denx.de> 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 Dear Francis, 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. Thanks a lot, much appreciated. > Nonetheless, the idea of this port is to be compatible. 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. In such a situation, we should accept the bug fix and not try tokeep the old, buggy behaviour of the old version. > 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. > The behavior of 2021 is coherent with the definition of these operators [4]: > > The return status of AND and OR lists is the exit > > status of the last command executed in the list. This is a clear bug in the old version. It's good to see it fixed in the recent code. > An other example concerns variable expansion, where foo='bar "quux" is > expanded to bar quux in U-Boot and bar "quux in Busybox. I guess you mean foo='bar "quux' ? [ foo='bar "quux" is missing the closing apostrophe.] Again, this is a bug in U-Boots command line parsing. > I do not have a real opinion on the second one, as I think local variable set > in U-Boot scripts are quite simple as people do not try to do: foo="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. 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. > So, porting Busybox 2021 hush can solve bugs we have currently in U-Boot, but > what if fixing these bugs lead to a board script failing and so a device not > booting... 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. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de "Don't try to outweird me, three-eyes. I get stranger things than you free with my breakfast cereal." - Zaphod Beeblebrox in "Hitchhiker's Guide to the Galaxy"