#!/bin/sh
set -x

rm -r /tmp/target

duplicity --no-encryption --name=foo /usr/bin file:///tmp/target --volsize=2 -v4 &
pid=$!
sleep 20
kill -9 $pid

last=$(ls -1v /tmp/target | tail -n 1)
cp /usr/bin/duplicity /tmp/target/$last # junk data

duplicity --no-encryption --name=foo /usr/bin file:///tmp/target --volsize=2 -v4

if diff /tmp/target/$last /usr/bin/duplicity; then
  echo "Guh!  We hit the bug!"
else
  echo "Yay!  We didn't hit the bug!"
fi
