From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dan.rpsys.net (dan.rpsys.net [93.97.175.187]) by mail.openembedded.org (Postfix) with ESMTP id 3305060144 for ; Tue, 21 Jan 2014 22:31:22 +0000 (UTC) Received: from localhost (dan.rpsys.net [127.0.0.1]) by dan.rpsys.net (8.14.4/8.14.4/Debian-2.1ubuntu4) with ESMTP id s0LMTmZT004789 for ; Tue, 21 Jan 2014 22:31:17 GMT X-Virus-Scanned: Debian amavisd-new at dan.rpsys.net Received: from dan.rpsys.net ([127.0.0.1]) by localhost (dan.rpsys.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ITHuzQpjFqDf for ; Tue, 21 Jan 2014 22:31:17 +0000 (GMT) Received: from [192.168.3.10] (rpvlan0 [192.168.3.10]) (authenticated bits=0) by dan.rpsys.net (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id s0LMVFQI004809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 21 Jan 2014 22:31:16 GMT Message-ID: <1390343468.874.123.camel@ted> From: Richard Purdie To: bitbake-devel Date: Tue, 21 Jan 2014 22:31:08 +0000 X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Subject: [PATCH] fetch2/wget: Check downloaded file isn't zero size X-BeenThere: bitbake-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussion that advance bitbake development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 22:31:22 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit I can't think of a reason we'd download zero sized files however there are reasons zero length files can accidently make it onto source mirrors. This check allows us to ignore the broken files and switch to another mirror rather than fail with odd checksum failures. Signed-off-by: Richard Purdie diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py index 0073201..7cd25a5 100644 --- a/lib/bb/fetch2/wget.py +++ b/lib/bb/fetch2/wget.py @@ -91,6 +91,10 @@ class Wget(FetchMethod): if not os.path.exists(ud.localpath) and not checkonly: raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, ud.localpath), uri) + if not checkonly and os.path.getsize(ud.localpath) == 0: + os.remove(ud.localpath) + raise FetchError("The fetch of %s resulted in a zero size file?! Deleting and failing since this isn't right." % (uri), uri) + return True def checkstatus(self, ud, d):