#!/bin/sh

# test - exposes possible gnu tar incremental bug
# V.1 - spd@daphne.cps.unizar.es
# V.2 - erco@netcom.com - added sleeps
# V.3 - erco@netcom.com - added $TAR

#SLEEP="sleep 2"        # sleep: uncomment this, it FAILS
SLEEP="sleep 0"         # no sleep: uncomment this, it works (sometimes)

TAR=gtar                # name you call tar 1.12

V=v                     # verbose
#V=""                   # quiet

uname -a | sed -e "s/`hostname`/xxx/" # :-)
$TAR --version | head -1
rm -rf snapshot subdir
mkdir subdir ; touch subdir/a subdir/b subdir/c
echo Full:
$SLEEP
$TAR c${V}sfg /usr/tmp/fulldump.tar snapshot subdir
$SLEEP
rm subdir/a
$SLEEP
mv subdir/b subdir/B
$SLEEP
touch subdir/D
$SLEEP
echo Level 1:
$TAR c${V}sfg /usr/tmp/inc-1.tar snapshot subdir
$SLEEP
echo Subdir:
find subdir -print
rm -rf subdir
echo Full:
$TAR x${V}fsg /usr/tmp/fulldump.tar snapshot
echo Level 1:
$TAR x${V}fsg /usr/tmp/inc-1.tar snapshot
echo Subdir:
find subdir -print
rm -rf snapshot /usr/tmp/fulldump.tar /usr/tmp/inc-1.tar subdir

