From owner-svn-src-all@FreeBSD.ORG Thu Nov 14 09:22:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF349D8A; Thu, 14 Nov 2013 09:22:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9F73229D9; Thu, 14 Nov 2013 09:22:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAE9MWX7043457; Thu, 14 Nov 2013 09:22:32 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAE9MW39043456; Thu, 14 Nov 2013 09:22:32 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201311140922.rAE9MW39043456@svn.freebsd.org> From: Colin Percival Date: Thu, 14 Nov 2013 09:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258124 - head/usr.sbin/portsnap/portsnap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2013 09:22:32 -0000 Author: cperciva Date: Thu Nov 14 09:22:32 2013 New Revision: 258124 URL: http://svnweb.freebsd.org/changeset/base/258124 Log: When verifying that files we need are present, also check that they don't have zero length. Filesystem corruption will tend to truncate files, and since these are short that's likely to result in them becoming empty. Suggested by: Richard Clayton Convinced by: rwatson MFC after: 3 weeks Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- head/usr.sbin/portsnap/portsnap/portsnap.sh Thu Nov 14 09:19:50 2013 (r258123) +++ head/usr.sbin/portsnap/portsnap/portsnap.sh Thu Nov 14 09:22:32 2013 (r258124) @@ -952,7 +952,7 @@ extract_run() { cat ${WORKDIR}/INDEX fi | while read FILE HASH; do echo ${PORTSDIR}/${FILE} - if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then + if ! [ -s "${WORKDIR}/files/${HASH}.gz" ]; then echo "files/${HASH}.gz not found -- snapshot corrupt." return 1 fi @@ -996,7 +996,7 @@ update_run_extract() { comm -13 ${PORTSDIR}/.portsnap.INDEX - | while read FILE HASH; do echo ${PORTSDIR}/${FILE} - if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then + if ! [ -s "${WORKDIR}/files/${HASH}.gz" ]; then echo "files/${HASH}.gz not found -- snapshot corrupt." return 1 fi