From: Koen Kooi <k.kooi@student.utwente.nl>
To: openembedded-devel@lists.openembedded.org
Subject: Re: [PATCH] Add error handling to read_cache in stage-manager
Date: Mon, 26 Apr 2010 12:20:20 +0200 [thread overview]
Message-ID: <hr3pd4$akp$1@dough.gmane.org> (raw)
In-Reply-To: <1272274382-1983-1-git-send-email-mchazaux@adeneo-embedded.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Looks good to me,
Acked-By: Koen Kooi <koen@openembedded.org>
On 26-04-10 11:33, Mickaël Chazaux wrote:
> Sometimes stage-manager crashes with this message :
> Traceback (most recent call last):
> File "/home/mchazaux/projet/OE/openembedded/recipes/stage-manager/files/stage-manager",
> line 79, in <module>
> cache = read_cache(options.cachefile)
> File "/home/mchazaux/projet/OE/openembedded/recipes/stage-manager/files/stage-manager",
> line 34, in read_cache
> cache[data[0]]['ts'] = int(data[1])
> IndexError: list index out of range
>
> This is due to a corrupted cache file. This patch adds an error message
> telling the cause of the crash to the user.
> ---
> recipes/stage-manager/files/stage-manager | 14 +++++++++-----
> recipes/stage-manager/stagemanager-native_0.0.1.bb | 2 +-
> 2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/recipes/stage-manager/files/stage-manager b/recipes/stage-manager/files/stage-manager
> index 536d1af..93196ff 100755
> --- a/recipes/stage-manager/files/stage-manager
> +++ b/recipes/stage-manager/files/stage-manager
> @@ -29,11 +29,15 @@ def read_cache(cachefile):
> lines = f.readlines()
> f.close()
> for l in lines:
> - data = l.split('|')
> - cache[data[0]] = {}
> - cache[data[0]]['ts'] = int(data[1])
> - cache[data[0]]['size'] = int(data[2])
> - cache[data[0]]['seen'] = False
> + try:
> + data = l.split('|')
> + d = cache[data[0]] = {}
> + d['ts'] = int(data[1])
> + d['size'] = int(data[2])
> + d['seen'] = False
> + except IndexError, e:
> + print("Corrupted line in cachefile " + cachefile + " : " + l)
> + raise e
> return cache
>
> def mkdirhier(dir):
> diff --git a/recipes/stage-manager/stagemanager-native_0.0.1.bb b/recipes/stage-manager/stagemanager-native_0.0.1.bb
> index 5708045..4357517 100644
> --- a/recipes/stage-manager/stagemanager-native_0.0.1.bb
> +++ b/recipes/stage-manager/stagemanager-native_0.0.1.bb
> @@ -1,5 +1,5 @@
> DESCRIPTION = "Helper script for packaged-staging.bbclass"
> -PR = "r11"
> +PR = "r13"
>
> SRC_URI = "file://stage-manager \
> file://stage-manager-ipkg \
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
iD8DBQFL1WjkMkyGM64RGpERAt8oAJ9mwOyDvMIdKcnwwwT+FKNCf+96SACgm+DY
c1xLNKOJQXZjZurAa6nNGiU=
=QDGW
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2010-04-26 10:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-26 9:33 [PATCH] Add error handling to read_cache in stage-manager Mickaël Chazaux
2010-04-26 10:20 ` Koen Kooi [this message]
2010-04-26 14:48 ` Chris Larson
2010-04-26 15:25 ` Mickael Chazaux
-- strict thread matches above, loose matches on Subject: below --
2010-04-27 7:53 Mickaël Chazaux
2010-04-27 14:10 ` Chris Larson
2010-04-30 12:25 Mickaël Chazaux
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='hr3pd4$akp$1@dough.gmane.org' \
--to=k.kooi@student.utwente.nl \
--cc=openembedded-devel@lists.openembedded.org \
/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.