All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gary Thomas <gary@mlbassoc.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: poky@yoctoproject.org
Subject: Re: SRC checksum checking broken
Date: Tue, 17 Apr 2012 10:59:45 -0600	[thread overview]
Message-ID: <4F8DA181.9070005@mlbassoc.com> (raw)
In-Reply-To: <1334679589.616.106.camel@ted>

On 2012-04-17 10:19, Richard Purdie wrote:
> On Tue, 2012-04-17 at 09:59 -0600, Gary Thomas wrote:
>> On 2012-04-17 09:44, Richard Purdie wrote:
>>> On Tue, 2012-04-17 at 09:21 -0600, Gary Thomas wrote:
>>>> On 2012-04-17 09:01, Richard Purdie wrote:
>>>>> On Tue, 2012-04-17 at 06:17 -0600, Gary Thomas wrote:
>>>>>> On 2012-04-10 19:36, Gary Thomas wrote:
>>>>>> This is still broken, both in master (04d6aa1) and 1.2_M4.rc4 (4d9f4d6)
>>>>>> Filed as https://bugzilla.yoctoproject.org/show_bug.cgi?id=2311
>>>>>
>>>>> Does this help?:
>>>>>
>>>>> bitbake/fetch2: Ensure directly mirrored files have their checksum validated
>>>>>
>>>>> Signed-off-by: Richard Purdie<richard.purdie@linuxfoundation.org>
>>>>> ---
>>>>> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
>>>>> index 414cc2b..e36d3ec 100644
>>>>> --- a/bitbake/lib/bb/fetch2/__init__.py
>>>>> +++ b/bitbake/lib/bb/fetch2/__init__.py
>>>>> @@ -477,7 +477,10 @@ def try_mirrors(d, origud, mirrors, check = False):
>>>>>                 if not os.path.exists(ud.donestamp) or ud.method.need_update(newuri, ud, ld):
>>>>>                     ud.method.download(newuri, ud, ld)
>>>>>                     if os.path.exists(ud.localpath):
>>>>> -                    open(ud.donestamp, 'w').close()
>>>>> +                    if ud.localpath == origud.localpath:
>>>>> +                        update_stamp(newuri, origud, ld)
>>>>> +                    else:
>>>>> +                        open(ud.donestamp, 'w').close()
>>>>>                         if hasattr(ud.method,"build_mirror_data"):
>>>>>                             ud.method.build_mirror_data(newuri, ud, ld)
>>>>
>>>> It does fix the case when using DL_DIR, but own-mirrors is still broken.
>>>> Note: both used to work correctly.
>>>
>>> Can you give more details of the configuration please? Is this using
>>> file:// urls?
>>
>> Here's what I use.  I've not tried any other transport method:
>>     SOURCE_MIRROR_URL ?= "file:///work/misc/Poky/sources/"
>>     INHERIT += "own-mirrors"
>
> Part of me wants to argue that its not expected to check checksums for
> file:// urls, as indicated for example by the code:
>
> def verify_checksum(u, ud, d):
>      [...]
>      if not ud.type in ["http", "https", "ftp", "ftps"]:
>          return
>
> but I can see a case for wanting to check the checksums I guess.

Well, it seems that the checksums are encouraged, if not required, these days.
I was just making sure that they actually work & in my opinion, it shouldn't
matter how you got the file, the checksums should still be checked and match.

>
> Perhaps this will work better?
>
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index 414cc2b..329b5bc 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -477,7 +477,6 @@ def try_mirrors(d, origud, mirrors, check = False):
>               if not os.path.exists(ud.donestamp) or ud.method.need_update(newuri, ud, ld):
>                   ud.method.download(newuri, ud, ld)
>                   if os.path.exists(ud.localpath):
> -                    open(ud.donestamp, 'w').close()
>                       if hasattr(ud.method,"build_mirror_data"):
>                           ud.method.build_mirror_data(newuri, ud, ld)
>
> @@ -492,12 +491,14 @@ def try_mirrors(d, origud, mirrors, check = False):
>               dldir = ld.getVar("DL_DIR", True)
>               if os.path.basename(ud.localpath) != os.path.basename(origud.localpath):
>                   dest = os.path.join(dldir, os.path.basename(ud.localpath))
> +                open(ud.donestamp, 'w').close()
>                   if not os.path.exists(dest):
>                       os.symlink(ud.localpath, dest)
>                   return None
>               # Otherwise the result is a local file:// and we symlink to it
>               if not os.path.exists(origud.localpath):
>                    os.symlink(ud.localpath, origud.localpath)
> +            update_stamp(newuri, origud, ld)
>               return ud.localpath
>
>           except bb.fetch2.NetworkAccess:

Sadly, this is much worse.  It even [somehow] reached "through" my
mirror setup and deleted the file on the backing store (i.e. the
file /work/misc/Poky/sources/busybox-1.19.4.tar.bz2 gets deleted
when the checksum fails even though it's part of the own-mirror)

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


  reply	other threads:[~2012-04-17 16:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 20:10 SRC checksum checking broken Gary Thomas
2012-04-10 23:27 ` Richard Purdie
2012-04-11  0:14   ` Gary Thomas
2012-04-11  1:36     ` Gary Thomas
2012-04-17 12:17       ` Gary Thomas
2012-04-17 15:01         ` Richard Purdie
2012-04-17 15:21           ` Gary Thomas
2012-04-17 15:44             ` Richard Purdie
2012-04-17 15:59               ` Gary Thomas
2012-04-17 16:19                 ` Richard Purdie
2012-04-17 16:59                   ` Gary Thomas [this message]
2012-04-17 21:20                     ` Richard Purdie
2012-04-17 22:14                       ` Gary Thomas
2012-05-13 12:39                         ` Richard Purdie
2012-05-13 22:24                           ` Gary Thomas
2012-05-20  8:29                             ` Richard Purdie
2012-05-21 14:30                               ` Gary Thomas

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=4F8DA181.9070005@mlbassoc.com \
    --to=gary@mlbassoc.com \
    --cc=poky@yoctoproject.org \
    --cc=richard.purdie@linuxfoundation.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.