[U-Boot] Return value of run command

Tom Rini trini at ti.com
Fri Jun 27 18:32:05 CEST 2014


On Fri, Jun 27, 2014 at 12:24:49PM -0400, Tom Rini wrote:
> On Fri, May 30, 2014 at 05:03:36PM +0200, Enric Balletbo Serra wrote:
> > Hi all,
> > 
> > Should the command 'run something"' return the value that returns
> > "something" or just return "true" if can execute something and "false"
> > if it can't ?
> > 
> > I'll explain. Imagine you have a variable that loads a file from the
> > mmc but this files doesn't exist.
> > 
> >   loadfile=load mmc ${mmcdev} ${loadaddr} my-file
> > 
> > In the case you do the following script
> > 
> >     if run loadfile; then  echo "true"; else echo "false"; fi
> > 
> > the result is always "true", either the file doesn't exist
> > 
> > OTOH, if you do :
> > 
> >     if ${loadfile}; then echo "true"; else echo "false"; fi
> > 
> > Then the result is "true" if file exist and "false" if file doesn't exist.
> > 
> > For me looks like the "run something" command should return the result
> > of the command but this is not the behaviour. With current behaviour
> > something like CONFIG_EXTRA_ENV_SETTINGS from
> > include/configs/am335x_evm.h file,
> > 
> > 129                         "echo SD/MMC found on device ${mmcdev};" \
> > 130                         "if run loadbootenv; then " \
> > 131                                 "echo Loaded environment from ${bootenv};" \
> > 132                                 "run importbootenv;" \
> > 133                         "fi;" \
> > 
> > 
> > Either uEnv.txt file exist or not, the "run loadbootenv" always
> > returns true, so always tries to run "run importbootenv". I supose
> > this is not the expected behaviour.
> > 
> > The question is. It's a problem with run command or with the
> > definition of CONFIG_EXTRA_ENV_SETTING, that should be something like
> > that:
> > 
> > - 130                         "if run loadbootenv; then " \
> > + 130                         "if ${loadbootenv}; then " \
> 
> Sorry for sitting on this for so long.  There's been a change in
> behaviour that I'm going to go track down now and see what we can do
> about.

Derp-de-derp, yes, we've fixed this regression since then, time to track
down if I've got an outstanding pull request to Albert somewhere..

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140627/80d407b7/attachment.pgp>


More information about the U-Boot mailing list