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=-7.2 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,URIBL_BLOCKED,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 D1510C07E96 for ; Tue, 6 Jul 2021 15:43:57 +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 35ADD6143B for ; Tue, 6 Jul 2021 15:43:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35ADD6143B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE62582C81; Tue, 6 Jul 2021 17:43:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.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=konsulko.com header.i=@konsulko.com header.b="DQ+ZJjFR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 67DAA82D2D; Tue, 6 Jul 2021 17:43:53 +0200 (CEST) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (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 0409782BFF for ; Tue, 6 Jul 2021 17:43:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x72a.google.com with SMTP id q190so20562425qkd.2 for ; Tue, 06 Jul 2021 08:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=InahMQngBIwaCY7lrijemvpUNIbKridYYEDgNczF3bg=; b=DQ+ZJjFR68r+/4LT/HjupPlQxaWD/sBS6c3oddmX/WfepGl65G2PRvugRPgqlPF6/8 edhAGNPmbvksxs42jUBLNQrNQ7Q1pbiwW2gKD43JOxplfu7tebrL6co7d8QBhF+cqx6p wOSUofuDFXccfbC6MZKb2LbcF/M3u1w2iAPI8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=InahMQngBIwaCY7lrijemvpUNIbKridYYEDgNczF3bg=; b=lhT/q4sA2CEB8AeyCKfFmDw9FbZZbo6m3A8Tpsj7mopKALjsWq0ukmqXnoOA1XUwlE XON+V+F6g5cSdcexGmjUp9gbMnWYkx1e0rN1msJAJEyG+pNJh8exMQ+VOSs7YJyhF1kd WJuhp1V8vxFvkx6QDWeGMR4wiaMSYWYKuL0oVnrnF5rv5zX8G9wCZHLLKk80vHZQ0KPF ejoPch1mXbI0aUh5K9BWjCYEJD9OcrRi2HY3MElV+DncOTEd7bnv96YItTHPEKRvU5ef 1FNtXsSYr53RQAoa5qVUpC0b7J3B6SaOuMU55tGUJhIam+N9tdmK0fH6v3hhaOiV7qg6 9Ecg== X-Gm-Message-State: AOAM531sr9gP4w3Da/edL/NHRCgHdL3xFWYsDQRazdktwQqpxK5WRfCt QPQkhn51EnFyvsBr3SX4hmOw7Q== X-Google-Smtp-Source: ABdhPJysM5VFfrTJPibxcSoOUamahDQFIAaShL/bJZ5UeVNI5JNnQ4mDvVfcprGlgKaIj424cYpdLg== X-Received: by 2002:a37:cce:: with SMTP id 197mr20758678qkm.112.1625586228769; Tue, 06 Jul 2021 08:43:48 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-5170-f33c-21eb-73eb.res6.spectrum.com. [2603:6081:7b01:cbda:5170:f33c:21eb:73eb]) by smtp.gmail.com with ESMTPSA id t1sm5602513qtc.32.2021.07.06.08.43.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Jul 2021 08:43:48 -0700 (PDT) Date: Tue, 6 Jul 2021 11:43:46 -0400 From: Tom Rini To: Wolfgang Denk Cc: Sean Anderson , u-boot@lists.denx.de, Marek =?iso-8859-1?Q?Beh=FAn?= , Simon Glass , Roland Gaudig , Heinrich Schuchardt , Kostas Michalopoulos Subject: Re: [RFC PATCH 02/28] cli: Add LIL shell Message-ID: <20210706154346.GT9516@bill-the-cat> References: <20210701061611.957918-1-seanga2@gmail.com> <20210701061611.957918-3-seanga2@gmail.com> <126700.1625223815@gemini.denx.de> <8bbdb7a1-5085-a3b7-614f-12ae9aee8e8b@gmail.com> <18831.1625340810@gemini.denx.de> <20210705191058.GB9516@bill-the-cat> <192103.1625557460@gemini.denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="D82I1uHIrgZ3+1Nt" Content-Disposition: inline In-Reply-To: <192103.1625557460@gemini.denx.de> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) 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 --D82I1uHIrgZ3+1Nt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 06, 2021 at 09:44:20AM +0200, Wolfgang Denk wrote: > Dear Tom, >=20 > In message <20210705191058.GB9516@bill-the-cat> you wrote: > >=20 > > > > foo=3Dbar set foo bar > > > > echo $foo echo $foo > > > > > > > > if [ 1 -gt 2 ]; then if {1 > 2} { > > > > echo a echo a > > > > else } { > > > > echo b echo b > > > > fi } > > > > > > > > foo() { proc foo {first second} { > > > > echo $1 $2 echo $first $second > > > > } } > > > > > > > > for file in $(ls *.c); do foreach file [glob *.c] { > > > > echo $file echo $file > > > > done } > > > > > > > > fact() { > > > > if [ $1 -eq 0 ]; then > > > > echo 1 > > > > else > > > > echo $(($1 * $(fact $(($1 - 1))))) > > > > fi > > > > } > > > > > > > > proc fact {n} { > > > > if {$n} { > > > > expr {$n * [fact [expr {$n - 1}]]} > > > > } { > > > > return 1 > > > > } > > > > } > > > > > > > > Hopefully this gives you a bit of a feel for the basic differences. > >=20 > > Which of these things, from each column, can you do in the context of > > U-Boot? That's important too. >=20 > Well, with a current version of hush we can do: >=20 > -> foo=3Dbar > -> echo $foo > bar >=20 > -> if [ 1 -gt 2 ]; then > > echo a > > else > > echo b > > fi > b >=20 > -> foo() { > > echo $1 $2 > > } > -> foo bar baz > bar baz >=20 > -> for file in $(ls *.c); do > > echo $file > > done > ls: cannot access '*.c': No such file or directory >=20 > -> fact() { > > if [ $1 -eq 0 ]; then > > echo 1 > > else > > echo $(($1 * $(fact $(($1 - 1))))) > > fi > > } > -> fact 4 > 24 >=20 >=20 > Oh, in the contect of U-Boot? Well, there are of course > limitations, but not because of the shell, but because of the fact > that we have no concept of files, for example. >=20 > But another command interpreter will not fix this. Yes, clearly the file based examples won't work either way, as-is. I was asking for what things can be done today with the implementations we have now. I'm pretty confident that exactly zero people have written complex U-Boot scripts and then been happy about the experience. > > This is I think the hard question. A draw of the current shell is that > > it it looks and acts like bash/sh/etc, for at least basic operations. > > That's something that's comfortable to a large audience. That has > > disadvantages when people want to start doing something complex. Sean > > has shown that several times and he's not the only one. LIL being > > tcl'ish is not. >=20 > Tcl is a horror of a language for anything that is above trivial > level. TCL has its fans. csh has it's fans. The question isn't what's the best desktop shell or general scripting language, but what's the most useful in our environment an use cases. > Do you really think that replacing standard shell syntax with Tcl is > "something that's comfortable to a large audience"? I seriously > doubt that. I don't know if it's right either. But drawing on my comment just now and above about complex boot scripts, I also don't know if "it's sh but quirky and incomplete, WHY DOESN'T THIS WORK RIGHT" is better than "It's TCL? I don't know that, let me hit stackoverflow and do a little reading" as would be the common experience. Especially if we document up-front what the quirks we have are. > > Something that has "sh" syntax but also clear to the user errors when > > trying to do something not supported would also be interesting to see. > > It seems like a lot of the frustration from users with our shell is that > > it's not clear where the line between "this is an sh-like shell" and > > "no, not like that" is. >=20 > Did you run some tests on the version of hush as comes with recent > busybox releases? Which of our user's requirements does it fail to > meet? It fails to meet the requirement of having been ported to U-Boot. I'd joke that perhaps you can bootefi busybox, but a quick search says that particular trick looks to still just be for python (https://lwn.net/Articles/641244/). --=20 Tom --D82I1uHIrgZ3+1Nt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmDkeisACgkQFHw5/5Y0 tyym+Qv8CUjz+rX+SsMVL/tg5cQJyYuMx6TM38Vfa2eTrYgpRR4scn9xbaxM/sQx OTboTzN4jf+1eIGqTPIx0lJecfy3oG8Co+61PtWj3DWb+B6eeGLfOsXGaJHOTZMk JnodlagqGhAOC+NYyYBZ31ToruLe3zhP2eIaNHcSY0L7UaltC7QwJ3HZxzeToz4R CoVK54aDWMHXqV2dL19bSaVk/bjmhrBZ+c1gIM92Ls4T+fdT7PCTSt7K+dlD7xy1 xdVoK8Xood2qgxeF9KY8UJhoEbJIW56tCfHFT6BUG6K5s8Qu8bKXT5fVHrGOoUHX VGQLGY4x7Zyy7Nji3ws678zyGOQXOnD2eNvRz0OSpf6IwHJxxh2KUBWjg7lxd+5B 1tUyfb49IPLwgx1s96G6jncYv7bIy8tKwUZIXXfDPzYfBzZe/TojdGXIVB6TyygZ j8GB4nryRY3OOzE0q4LvF/UM7NR3dSKO7slKSQl1L1tvGUMBoPutZpFpnZUIMEA7 bdKLkGDH =/5ow -----END PGP SIGNATURE----- --D82I1uHIrgZ3+1Nt--