mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Erwin Rol <mailinglists@erwinrol.com>
Cc: barebox@lists.infradead.org
Subject: Re: script error
Date: Tue, 8 Jun 2010 08:49:29 +0200	[thread overview]
Message-ID: <20100608064929.GC20799@pengutronix.de> (raw)
In-Reply-To: <4C081332.6080904@erwinrol.com>

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

      parent reply	other threads:[~2010-06-09  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03 20:40 Erwin Rol
2010-06-03 20:52 ` Eric Bénard
2010-06-08  6:49 ` Sascha Hauer [this message]

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=20100608064929.GC20799@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mailinglists@erwinrol.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox