#! /sbin/sh # # (c)Copyright 1997 Hewlett-Packard Co., All Rights Reserved. # @(#) findholes $Revision: 10.3 $ # # # Find all files that have holes in them (sparse files) that could # have been caused by the pax command. Sparse executables can core # dump on HP-UX 10.X, so this is a workaround for that defect. # # A future release of Ignite-UX is likely to use a version of pax that # does not create sparse files. There may also be a kernel patch that # allows sparse executables to work correctly. # START=${1:-/} unset LANG typeset -i realsize cursize echo " * Searching filesystem for sparse files created by pax." find $START -fsonly hfs -fsonly vxfs \ -type f \( -perm -001 -o -perm -010 -o -perm -100 \) | \ while read file do # Use the fact that "cp" does not preserve holes in a file # and thus the copy of the file will report a large disk usage # than the original. cp -p $file ${file}.duchk set -- $(du ${file}.duchk) realsize=$1 set -- $(du $file) cursize=$1 if [ $realsize -ne $cursize ] ; then echo " * Found/fixing sparse executable: $file" mv ${file}.duchk $file else rm -f ${file}.duchk fi done