mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* script error
@ 2010-06-03 20:40 Erwin Rol
  2010-06-03 20:52 ` Eric Bénard
  2010-06-08  6:49 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Erwin Rol @ 2010-06-03 20:40 UTC (permalink / raw)
  To: barebox

Hallo,

i have a problem with running scripts. It seems that as soon a command 
in a script fails the whole script is terminated.

I am trying the following in /env/bin/init

echo "Loading env A"
mkdir /env_a/
loadenv /dev/biosdisk0.1 /env_a/
if [ -f /env_a/revision ]; then
         . /env_a/revision
fi


The /dev/biosdisk0.1 is empty so the loadenv fails, and that also stops 
the /env/bin/init script, everything after the "fi" is never executed.

any ideas ?

- Erwin


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: script error
  2010-06-03 20:40 script error Erwin Rol
@ 2010-06-03 20:52 ` Eric Bénard
  2010-06-08  6:49 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Bénard @ 2010-06-03 20:52 UTC (permalink / raw)
  To: Erwin Rol; +Cc: barebox

Hi Erwin,

Le 03/06/2010 22:40, Erwin Rol a écrit :
> i have a problem with running scripts. It seems that as soon a command
> in a script fails the whole script is terminated.
>
> any ideas ?
>
I met the same problem in init yesterday. I didn't yet had time to 
investigate more.

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: script error
  2010-06-03 20:40 script error Erwin Rol
  2010-06-03 20:52 ` Eric Bénard
@ 2010-06-08  6:49 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2010-06-08  6:49 UTC (permalink / raw)
  To: Erwin Rol; +Cc: barebox

Hi Erwin,

Sorry for the delay.

On Thu, Jun 03, 2010 at 10:40:18PM +0200, Erwin Rol wrote:
> Hallo,
>
> i have a problem with running scripts. It seems that as soon a command  
> in a script fails the whole script is terminated.
>
> I am trying the following in /env/bin/init
>
> echo "Loading env A"
> mkdir /env_a/
> loadenv /dev/biosdisk0.1 /env_a/
> if [ -f /env_a/revision ]; then
>         . /env_a/revision
> fi
>
>
> The /dev/biosdisk0.1 is empty so the loadenv fails, and that also stops  
> the /env/bin/init script, everything after the "fi" is never executed.

That is because of the wrong exit code of loadenv. In do_loadenv we have

return envfs_load(filename, dirname);

which returns negative numbers as errors. The shell interpretes negative
numbers as return codes from commands as 'exit', so this should really be

return envfs_load(filename, dirname) ? 1 : 0;

Probably other commands have this bug aswell.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-09  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-03 20:40 script error Erwin Rol
2010-06-03 20:52 ` Eric Bénard
2010-06-08  6:49 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox