All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/3] allow positional arguments with "run" command
Date: Mon, 19 Oct 2020 09:31:05 +0200	[thread overview]
Message-ID: <259038.1603092665@gemini.denx.de> (raw)
In-Reply-To: <2284dd1d-f20c-6246-805e-55454a581960@prevas.dk>

Dear Rasmus,

In message <2284dd1d-f20c-6246-805e-55454a581960@prevas.dk> you wrote:
>
> > Yes that's good, but is the plan now to take these patches rather than
> > update to the latest hush? I was wondering is Buzybox has any tests
> > for hush.
>
> Well, updating the whole hush code is not, as I've said before,
> something I can or will take on me ATM, and it's not even clear that
> that would automatically provide real shell functions.

Yes, current versions of busybox hush do implement shell functions;
tested under Fedora 32:

-> rpm -q busybox
busybox-1.31.1-2.fc32.x86_64
-> cd /tmp
-> ln -s /sbin/busybox hush
-> ./hush
-> foo() {
> echo argc=$# arg1=$1 arg2=$2 arg3=$3
> }
-> foo
argc=0 arg1= arg2= arg3=
-> foo aa
argc=1 arg1=aa arg2= arg3=
-> foo aa bb
argc=2 arg1=aa arg2=bb arg3=
-> foo aa bb cc
argc=3 arg1=aa arg2=bb arg3=cc
-> foo aa bb cc dd
argc=4 arg1=aa arg2=bb arg3=cc
-> exit

No, I cannot see any shell / hush related test code in the busybox
repository.

> Whether "the plan" includes accepting these patches I can't say. I'm
> just trying to plug a hole and make the U-Boot shell a little more
> usable. It's somewhat similar to the setexpr command; we don't have
> $((a+4)) arithmetic, but can achieve the same thing with an extra
> command. Or askenv, which takes the place of 'read -p'. Or run, for that
> matter, which combined with setenv can do much of what eval in a POSIX
> shell could do. And with 3/3, there's a place to put tests of e.g.
> setexpr (not that adding the boilerplate is hard, but it is a tedious
> first step; once that is in place, adding extra test cases is somewhat
> easier and natural).

Well, that's note really the same.  For shell functions, ther eis
now a (hopefully) clean implementation in recent versions of hush,
so upgrading to a recent version would not only solve the
problem/task we're discussing here, but also bring a lot of other
bug fixes and improvements.

The examples you mentioned above are moe related to U-Boots concept
of environment handling, which is idependent of the shell we are
using i. e. it's the same with U-Boots own trivial command parser.


My big concern here is that adding bells and whistles to our ancient
version of hush will just make it all the harder to upgrade to a
recent version.  Already now we have the situation that we must be
afraid to break existing code which works around some of the
problems.  Adding more "special code" will not make this better.

And even if we can upgrade to a new version independently, we still
might have to keep this workaround code for compatibility, as people
started using it, and it is not compatible with any existing shell.


So the _much_ better approach would indeed be to upgrade to a recent
version of hush.


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 at denx.de
I have a very small mind and must live with it.    -- Edsger Dijkstra

  reply	other threads:[~2020-10-19  7:31 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 11:19 [PATCH 0/3] add "call" command Rasmus Villemoes
2020-09-25 11:19 ` [PATCH 1/3] cli_hush.c: refactor handle_dollar() to prepare for cmd_call Rasmus Villemoes
2020-09-25 13:02   ` Wolfgang Denk
2020-09-25 11:19 ` [PATCH 2/3] cli_hush.c: add "call" command Rasmus Villemoes
2020-09-25 13:18   ` Rasmus Villemoes
2020-09-26  8:37     ` Wolfgang Denk
2020-09-25 11:19 ` [PATCH 3/3] ut: add small hush tests Rasmus Villemoes
2020-09-25 11:52 ` [PATCH 0/3] add "call" command Heinrich Schuchardt
2020-09-25 12:36   ` Rasmus Villemoes
2020-09-25 13:09   ` Wolfgang Denk
2020-09-25 13:38     ` Rasmus Villemoes
2020-09-25 13:38     ` Heinrich Schuchardt
2020-09-25 13:51       ` Rasmus Villemoes
2020-09-26  8:55         ` Wolfgang Denk
2020-09-26  8:51       ` Wolfgang Denk
2020-09-26 10:39         ` Heinrich Schuchardt
2020-09-26 14:13           ` Wolfgang Denk
2020-09-25 12:59 ` Wolfgang Denk
2020-09-25 14:40   ` Simon Glass
2020-09-26 14:02     ` Wolfgang Denk
2020-09-29 17:45       ` Tom Rini
2020-09-30 11:46         ` Wolfgang Denk
2020-10-07  7:20 ` [PATCH v2 0/3] allow positional arguments with "run" Rasmus Villemoes
2020-10-07  7:20   ` [PATCH v2 1/3] cli_hush.c: refactor handle_dollar() to prepare for "run with arguments" Rasmus Villemoes
2020-10-12  3:34     ` Simon Glass
2020-10-07  7:20   ` [PATCH v2 2/3] allow positional arguments with "run" command Rasmus Villemoes
2020-10-12  3:34     ` Simon Glass
2020-10-12  7:06       ` Rasmus Villemoes
2020-10-15 15:05         ` Simon Glass
2020-10-15 22:06           ` Rasmus Villemoes
2020-10-19  7:31             ` Wolfgang Denk [this message]
2020-10-19  8:31               ` Rasmus Villemoes
2020-10-19  8:49                 ` Wolfgang Denk
2020-10-07  7:20   ` [PATCH v2 3/3] ut: add small hush tests Rasmus Villemoes
2020-10-12  3:34     ` Simon Glass
2020-11-05  7:25   ` [PATCH v2 0/3] allow positional arguments with "run" Rasmus Villemoes
2020-11-06 20:52     ` Tom Rini
2020-11-08 13:28       ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=259038.1603092665@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.