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 10:49:22 +0200	[thread overview]
Message-ID: <263046.1603097362@gemini.denx.de> (raw)
In-Reply-To: <b8e3d765-d0a6-12da-5fc9-3e0da0818cb8@prevas.dk>

Dear Rasmus,

In message <b8e3d765-d0a6-12da-5fc9-3e0da0818cb8@prevas.dk> you wrote:
>
> > Yes, current versions of busybox hush do implement shell functions;
> > tested under Fedora 32:
>
> Not what I meant, of course busybox hush does that. What I meant is that
> it is not at all obvious how that support would actually benefit U-Boot.

um... I think you should define what you want.  You asked for shell
functions; I tell you they are supported; now you ask for something
else....

> The problem is how one would go about getting the functions defined. Putting
>
> define_func='func() { do_stuff $1 $2; do_more_stuff $3; }'
>
> in the environment and then having to say
>
> run define_func; func foo ...
>
> does not really look like an improvement to me. In contrast, the current

Shell functions is something you usually use as part of longer
scripts.  You can either define these as part of one or more
envrionment variables, or you can put these into a file or a U-Boot
image etc. and source it when needed.  There are many ways.

> way of defining "one-liner" functions and running with, well, run, is
> quite ergonomic - but I do miss the ability to provide parameters other
> than via global settings. With these patches, the above would just be
>
> func='do_stuff $1 $2; do_more_stuff $3;'
>
> run func -- foo ...

I can't see why you cannot do the same with shell fnctions?

setenv define_func 'func() { do_stuff $1 $2; do_more_stuff $3; }'
...
run define_func
func foo ...

> I guess one could have something like CONFIG_DOT_PROFILE and have that
> point at a script that gets built into the U-Boot binary and sourced at
> shell startup; then one could put one's functions in there, or have the
> flexibility of having that file load some stdlib.sh from somewhere.

You don't need any new defines for such a thing.   You can define
something like a sequence "test if file .profile exisits in some
stroage device; if yes, then source it" as past of your
CONFIG_USE_PREBOOT settings.

> I agree in principle - there are other shell features I'm also missing
> (though see above, I don't immediately see how an upgrade would make
> functions available in a useful way).

So do you want shell functions or any other standard shell features,
or do you just want to implement your own nonstandard ideas?  The
former I do support, the latter I don't...

> Someone speaking up and saying "I'm going to look at an overhaul of hush
> within the next year or so" would clearly be a strong argument against
> inclusion of these patches. Lacking such a pony promise, this really
> boils down to an idealist/pragmatist issue, and we can keep going around
> this in circles forever, so I think someone (Tom?) should make a decision.

As mentioned - addin more non-standard stuff will just create new
compatibility problems and make an upgrade more difficult and thus
less likely.

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 had the rare misfortune of being one of the first people to try and
implement a PL/1 compiler.                             -- T. Cheatham

  reply	other threads:[~2020-10-19  8:49 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
2020-10-19  8:31               ` Rasmus Villemoes
2020-10-19  8:49                 ` Wolfgang Denk [this message]
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=263046.1603097362@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.