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
This commit is contained in:
Colin Percival 2013-11-14 09:22:32 +00:00
parent be51503d79
commit 6fcfd7ab4e

View File

@ -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