Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 44746C433F5 for ; Sun, 6 Feb 2022 18:54:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 46ED183BB6; Sun, 6 Feb 2022 19:54:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de 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; secure) header.d=gmx.net header.i=@gmx.net header.b="dW6MR1jU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CBAE783BBF; Sun, 6 Feb 2022 19:54:35 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 37D248306E for ; Sun, 6 Feb 2022 19:54:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644173667; bh=5BITXT5gLvcNghGfMc73dEnmQNW9ZdJqcNYLHzX06ps=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=dW6MR1jUkNNt2WLETd4Z0FMlZjxn+IN8rNY7lgzrrN+1GBkGHPHxN3sTPG5x+FCUs 5xDCXNghZ3vOJcXLJm9GEDz9eEO9IiTY11zu2GzAJ5UIWesmrLmTQyLQFYKR8lti6I sltvHq4dH1myFxMTmfFf13lLHB/BKzdJOehsBOrg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.94] ([88.152.144.107]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MOzT4-1ng86B1fyu-00PQV2; Sun, 06 Feb 2022 19:54:27 +0100 Message-ID: Date: Sun, 6 Feb 2022 19:54:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [RFC PATCH v2 00/21] Modernize U-Boot shell Content-Language: en-US To: Francis Laniel Cc: Marek Behun , Michael Nazzareno Trimarchi , Simon Glass , Wolfgang Denk , Harald Seiler , u-boot@lists.denx.de References: <20220206183717.57446-1-francis.laniel@amarulasolutions.com> From: Heinrich Schuchardt In-Reply-To: <20220206183717.57446-1-francis.laniel@amarulasolutions.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Tdh2T8YKdEMYb7pNbFbHkpzcOIM8q/vBd67XOoXNbOIkw0fLxKy CFNwO/2Fjz8Gdlc7gTk6+rLT4wtFSGHdVpd6x3BQa8Ib7hUi29MIcip7K5kgKGu8/ohpJS8 BhKAmpfnLjyKbey4LMlvpQc1FSnI5QLlT6hEYSIFOb8xB01xROypZxvlv7rb9Zjts8oqm9k bTO/ZEC3rkZcg7mv+ABsQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:5jkVP8whB2o=:bqPGPHRAKtxT0JHYqFcPx5 sy3A/Qw0TaOiYkuH+/a06eh2W7+jOAOQV+xN6Tr63zU5fDag9i7wl8br8ujI6d5Ni95Qb7/71 LLO1fLv+/+PRIzSGGFoPOv1dc9DWL3EZNx6CHExkRMAAdo2/ZBGBjItmmSAaX9qm5RsHfAynY 0pdZBU2x5AwegBIdWCDHKnBxp/RYq4a/7LTvQ2IROUWPmk+caWEQSqSJjG3wqfdXDJ05m+PHM r9iduQKJYA7cyhEXky43gnNkw9zyZyLNhvnwYoDP3Ah+uSt1TCPSRPzfEqk7kAoggGS/DNsKa h5i+hE10z7KfXfzHP7gqIquQodTwmVxXSGPiPpcdJPoq1pGn8hJSztRBmXmOmwOTqjAz5D2q/ AjUxC1KJYG3G6OgSl6PKEyUB38XRv8bR5ImCmBWt4/FzHF8AjBBARpH80l0q41H7O3f/ffiZT 9ZI6bFQQhaNp0QehKkTcgGeIAyLCisC4aRwsn1/UPrlhHMsGx2m5tf544wobYvuMlpsXpOTT3 vX4eNbaZpM8I3H1fId88AHp4HdV+5EeUnvzkP8afdw5v/kzRTZo7++sD7pHb+utYI4J0/X8kX oGWIRZr6oLnUn1ntGJX/rUQr4PZNiJbyqDNt65Tg5s0r17IL5hUpcTAmxXW4tnKxleblAIQLa 09bl/TI4wC3bwBeFF3auO4WlgBLeHcSYyJ045NCL4brAYhfEXAIw6uhEJsr0ynPXjzNpnDj8d edPip6TfH00RKRy0p4+1fuMZBbZmhj44xlEgyW4WlVTcVfEqiA/EeZ5OfTNrjalJlW6ijKeP6 Yn14MN78JBhY+xD8b2ixcqD2kJjbUVpg0Do/NqlDNmNLhIEALF4dIQko4TJx+hTgK/qVy4CAj obt6aqhczzC1N7ggOLxrAV5e05ZBeafxSuwfP24ElgaBDlASzPPp+IeDppj6g6jQDF+fu6StY hMlwjOwvVAZe18deH0tzfGBzQO74QSC3MQTkVXDQWXFptvhqJSGbtQKM8gyLR0P/WDqqrZwTT yMtgHHNajAj9pFiFIqMCGxog6pseMrsz2sZ6J9TUe2KcUP0uzngtsX6PH/sFmSV+F605i9AIG d84BOQW4Ln+HYY= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean On 2/6/22 19:36, Francis Laniel wrote: > Hi. > > First I hope you are fine and the same for your relatives. > > During 2021 summer, Sean Anderson wrote a contribution to add a new shel= l, based > on LIL, to U-Boot [1][2]. > While one of the goals of this contribution was to address the fact actu= al > U-Boot shell, which is based on Busybox hush, is old there was a discuss= ion > about adding a new shell versus updating the actual one [3][4]. > > So, in this series, with Harald Seiler, we updated the actual U-Boot she= ll to > reflect what is currently in Busybox source code. > Basically, this contribution is about taking a snapshot of Busybox shell= /hush.c > file (as it exists in commit 37460f5da) and adapt it to suit U-Boot need= s. > > This contribution was written to be as backward-compatible as possible t= o avoid > breaking the existing. > So, the 2021 hush flavor offers the same as the actual, that is to say: > 1. Variable expansion. > 2. Instruction lists (;, && and ||). > 3. If, then and else. > 4. Loops (for, while and until). > No new features offered by Busybox hush were implemented (e.g. functions= ). If no new features are added relative to what we have, why should we add 12000 lines of code? Please, describe the benefit of the series. Is there a repo with your patches? Best regards Heinrich > > In terms of testing, new unit tests were added to ut to ensure the new b= ehavior > is the same as the old one and it does not add regression. > Nonetheless, if old behavior was buggy and fixed upstream, the fix is th= en added > to U-Boot [5]. > In sandbox, all of these tests pass smoothly: > 2021> printenv board > board=3Dsandbox > 2021> ut hush > Running 20 hush tests > ... > Failures: 0 > Thanks to the effort of Harald Seiler, I was successful booting a board: > 2021> printenv board_rev > board_rev=3DiMX8MP > 2021> boot > ... > root@iMX8MPboard:~# fw_printenv board_rev > board_rev=3DiMX8MP > > I marked this contribution as RFC to indeed collect your opinion. > My goal is not to change suddenly actual shell to this one, we clearly n= eed a > transition period to think about it. > I think it is better to see this contribution as a proof of concept whic= h shows > it is possible to update the actual shell. > > If you want to review it - your review will really be appreciated - here= are > some information regarding the commits: > * commits marked as "test:" deal with unit tests. > * commit "cli: Add Busybox upstream hush.c file." copies Busybox shell/h= ush.c > into U-Boot tree, this explain why this commit contains around 12000 add= itions. > * commit "cli: Port Busybox 2021 hush to U-Boot." modifies previously ad= ded file > to permit us to use this as new shell. > The really good idea of #include'ing Busybox code into a wrapper file to= define > some particular functions while minimizing modifications to upstream cod= e comes > from Harald Seiler. > * Other commits focus on enabling features we need (e.g. if). > > Changes since v1: > * Renamed cli_hush_2021_upstream.c to cli_hush_upstream.c. > * Addressed reviews regarding variable expansion unit test. > > Francis Laniel (21): > test: Add framework to test hush behavior > test: hush: Test hush if/else > test/py: hush_if_test: Remove the test file > test: hush: Test hush variable expansion > test: hush: Test hush commands list > test: hush: Test hush loops. > cli: Add Busybox upstream hush.c file > cli: Port Busybox 2021 hush to U-Boot > cli: Add choice for hush parser > cli: Add HUSH_2021_PARSER to hush parser choice > cli: Enables using hush 2021 parser as command line parser > cli: hush_2021: Enable variables expansion for hush 2021 > cli: hush_2021: Add functions to be called from run_command() > cli: Modify run_command() to add hush 2021 as parser > test: hush: Fix instructions list tests for hush 2021 > test: hush: Fix variable expansion tests for hush 2021 > cli: hush_2021: Enable using \< and \> as string compare operators > cli: hush_2021: Enable if keyword > test: hush: Fix if tests for hush 2021 > cli: hush_2021: Enable loops > test: hush: Fix loop tests for hush 2021 > > cmd/Kconfig | 22 + > common/Makefile | 3 +- > common/cli.c | 27 +- > common/cli_hush_2021.c | 309 + > common/cli_hush_upstream.c | 12791 +++++++++++++++++++++++++++ > include/cli_hush.h | 8 + > include/test/hush.h | 15 + > include/test/suites.h | 1 + > test/Makefile | 3 + > test/cmd_ut.c | 6 + > test/hush/Makefile | 10 + > test/hush/cmd_ut_hush.c | 20 + > test/hush/dollar.c | 226 + > test/hush/if.c | 351 + > test/hush/list.c | 127 + > test/hush/loop.c | 84 + > test/py/tests/test_hush_if_test.py | 184 - > 17 files changed, 13999 insertions(+), 188 deletions(-) > create mode 100644 common/cli_hush_2021.c > create mode 100644 common/cli_hush_upstream.c > create mode 100644 include/test/hush.h > create mode 100644 test/hush/Makefile > create mode 100644 test/hush/cmd_ut_hush.c > create mode 100644 test/hush/dollar.c > create mode 100644 test/hush/if.c > create mode 100644 test/hush/list.c > create mode 100644 test/hush/loop.c > delete mode 100644 test/py/tests/test_hush_if_test.py > > > Best regards and thank you in advance for your reviews. > --- > [1] https://lists.denx.de/pipermail/u-boot/2021-July/453347.html > [2] https://runtimeterror.com/tech/lil/ > [3] https://lists.denx.de/pipermail/u-boot/2021-July/453790.html > [4] https://lists.denx.de/pipermail/u-boot/2021-July/453848.html > [5] https://lists.denx.de/pipermail/u-boot/2021-August/458569.html > -- > 2.25.1 >