All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Stefan Klug <stefan.klug@baslerweb.com>,
	 bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 2/3] fetch2: Gracefully handle corrupt download-cache tarballs
Date: Mon, 18 Mar 2019 23:45:45 +0000	[thread overview]
Message-ID: <cf989d646a50e462b36a9f93481a3aba1618e8b4.camel@linuxfoundation.org> (raw)
In-Reply-To: <20190318135820.7344-3-stefan.klug@baslerweb.com>

On Mon, 2019-03-18 at 14:58 +0100, Stefan Klug wrote:
> If the fullmirror tarball is corrupt for whatever reason
> (IMHO there are no checksums on the download cache)
> a series of nasty events was triggered:
> - tar left a partially extracted bare git repo there
> - on the next yocto build, the corrupt bare repo is
>   found and bitbake starts to update that bare repo using git
> - git fails to detect it as bare repo. Therefore
>   all following git commands ripple up the directory tree,
>   in our case modifying a top level git repo.
> 
> Signed-off-by: Stefan Klug <stefan.klug@baslerweb.com>
> ---
>  lib/bb/fetch2/git.py | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> index 1a8ebe3d..d5f9bbcd 100644
> --- a/lib/bb/fetch2/git.py
> +++ b/lib/bb/fetch2/git.py
> @@ -334,8 +334,11 @@ class Git(FetchMethod):
>              ud.localpath = ud.fullshallow
>              return
>          elif os.path.exists(ud.fullmirror) and not os.path.exists(ud.clonedir):
> -            bb.utils.mkdirhier(ud.clonedir)
> -            runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir)
> +            try:
> +                bb.utils.mkdirhier(ud.clonedir)
> +                runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir, cleanup=[ud.clonedir])
> +            except:
> +                logger.info("Extracting tarball of git repository failed, falling back to clone.")

General "except:" clauses are a world of pain. Can we be more specific
here?

For an example of what I mean, put a syntax error in the command...

Cheers,

Richard




  reply	other threads:[~2019-03-18 23:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 13:58 [PATCH 0/3] Fix some bitbake authentication issues Stefan Klug
2019-03-18 13:58 ` [PATCH 1/3] fetch2: Fix fetching of git repositories with kerberos authentication Stefan Klug
2019-03-18 23:44   ` Richard Purdie
2019-03-18 13:58 ` [PATCH 2/3] fetch2: Gracefully handle corrupt download-cache tarballs Stefan Klug
2019-03-18 23:45   ` Richard Purdie [this message]
2019-03-18 13:58 ` [PATCH 3/3] fetch2/wget: Fix authentication in checkstatus() of the wget fetcher Stefan Klug
2019-03-19  6:28   ` Andre McCurdy

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=cf989d646a50e462b36a9f93481a3aba1618e8b4.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=stefan.klug@baslerweb.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 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.