svn commit: r258124 - head/usr.sbin/portsnap/portsnap
    Colin Percival 
    cperciva at FreeBSD.org
       
    Thu Nov 14 09:22:32 UTC 2013
    
    
  
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
    
    
More information about the svn-src-all
mailing list