While installing red hat 7.2 I found the following problems with tar.
Obvioulsy I waited a while for it to stabilize and installed all of
the "suggested" RPMs.
1. When restoring with same permissions and same owner, symlinks are
restored as 0 length files owned by root and permission 000.
2. Multiple level excludes are ignored.
I have written 2 shell scripts to test tar and point out if your tar
has the bugs. I'm enclosing them here (cut and paste not as enclosures).
If you run them from the tests directory of a tar distribution uncomment
the call to ./preset
Obviously BE CAREFULL when running anything as root.
Geoff.
--
Geoffrey S. Mendelson
Bloomberg L.P., BFM (Israel) 2 hours ahead of London, 7 hours ahead of New York.
Tel: 972-(0)3-754-1158 Fax 972-(0)3-754-1236 Email: [EMAIL PROTECTED]
-----------------------------------------------------------------------------
#!/bin/sh
#
# Restoring with same-owner and --same-permissions was creating
# 0 byte files instead of symlinks
#
# Writen by Geoffrey S. Mendelson February 2002
#
#
# Note: This test MUST be run as root!!!
#. ./preset
OUTDIR="/tmp"
ARCHIVE="$OUTDIR/link01test.tgz"
INDIR="$OUTDIR/bin"
rm -r $INDIR >/dev/null 2>/dev/null
rm $ARCHIVE >/dev/null 2>/dev/null
echo "creating tar of /bin"
tar -c -z -f $ARCHIVE -C / bin
echo "restoring tar of /bin"
tar --same-owner --same-permissions -x -z -C $OUTDIR -f $ARCHIVE
echo "looking for empty files in $INDIR"
echo "if you find any, it's a problem"
ZERO=`find $INDIR -type f -size 0 | wc | awk '{print $1}'`
echo $ZERO "zero length files found."
echo "looking for sybolic links in $INDIR"
echo "if you do not find any, it's a problem"
LINKS=`find $INDIR -type l | wc | awk '{print $1}'`
echo $LINKS "symbolic links found."
if [ $LINKS -eq 0 ] ; then
echo "oops, we have a problem."
exit 1;
fi
rm -r $INDIR >/dev/null 2>/dev/null
rm $ARCHIVE >/dev/null 2>/dev/null
echo "tar passed link test with no problem."
exit 0
-----------------------------------------------------------------------------
#!/bin/sh
#
# Dumping files with --exclude does not exclude the files.
#
# Writen by Geoffrey S. Mendelson February 2002
#
#. ./preset
OUTDIR="tmp"
LEVEL0="/$OUTDIR/exclude01"
LEVEL1="$LEVEL0/level1"
LEVEL2="$LEVEL1/level2"
LEVEL3="$LEVEL2/level3"
INDIR="$OUTDIR/exclude01"
EXCLUDE="$INDIR/level1/level2/level3/*"
rm -r $LEVEL0 >/dev/null 2>/dev/null
mkdir $LEVEL0
mkdir $LEVEL1
mkdir $LEVEL2
mkdir $LEVEL3
echo "hello" >$LEVEL1/a.file
echo "hello" >$LEVEL2/another.file
echo "hello" >$LEVEL3/athird.file
TARCMD="tar --exclude $EXCLUDE -c -v -f /dev/null -C / $INDIR"
echo $TARCMD
OOPS=`$TARCMD | grep athird`
if [ " $OOPS" == " " ] ; then
echo "tar handles multiple level excludes properly."
exit 0
fi
echo "tar dumped $OOPS and should have excluded it. Bad tar, bad."
exit 1
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]