misc/reproduce-restore-bug
changeset 14 d9b06b08b28d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/reproduce-restore-bug	Tue Dec 17 15:58:28 2013 +0100
@@ -0,0 +1,51 @@
+#! /bin/sh
+
+set -e
+
+cleanup() {
+    umount $mnt 2>/dev/null || true
+    losetup -vd $loop || true
+    rm -r $dir
+}
+
+trap cleanup EXIT
+
+dir=`mktemp -d`
+
+image=$dir/image
+mnt=$dir/mnt
+record=$dir/dumpdates
+
+echo "# creating sparse image file $image"
+dd of=$image count=0 bs=1M seek=128
+
+echo "# creating the mountpoint"
+mkdir $dir/mnt
+
+x=$(losetup -fv $image)
+loop=${x##* }
+echo "# image connected to $loop"
+
+mkfs -t ext4 $loop
+
+# installing sample data
+mount $loop $mnt
+mkdir $mnt/abc.d
+touch $mnt/abc.d/foo
+sync
+umount $mnt
+
+dump -0 -u -D $record -f $dir/dump-0 $loop
+
+# remove the dir
+mount $loop $mnt
+mv $mnt/abc.d/foo $mnt/
+rmdir $mnt/abc.d
+sync
+umount $mnt
+
+dump -1 -u -D $record -f $dir/dump-1 $loop
+
+# now starting a shell
+cd $dir
+$SHELL