]> git.michaelhowe.org Git - packages/b/bup.git/commit
rm-between-index-and-save.sh: fix race condition.
authorTim Riemenschneider <git@tim-riemenschneider.de>
Mon, 15 Apr 2013 19:54:18 +0000 (21:54 +0200)
committerRob Browning <rlb@defaultvalue.org>
Thu, 2 May 2013 02:16:04 +0000 (21:16 -0500)
commitbdd0054f60bb97518014ab5597d0d7cc3b596148
tree36cf1f3c6831e284ded82be36fafb767aa8ae1f4
parent92f68b03ca764f37e9dcb163cbce1dc8547f2911
rm-between-index-and-save.sh: fix race condition.

Fix a timing issue that often caused the test to fail -- the (removed)
file "foo" was marked as invalid in the index when it shouldn't have
been because it was modified less than tmax before the index run.

Insert a "bup tick" just before "bup index" so that foo won't be
marked invalid by the second run.

Don't expect the second "bup save" to fail since foo will now be valid
in the index (and hence ignored), even though it is no longer
available.  The removal will be noticed by the next index+save.

When removing directories, the outcome is different: since metadata is
saved per directory, "bup save" notices that the directory is missing
and logs an "errno 2" error, but does not crash, which is what the
tested patch is concerned with.  A third index+save run completes
without error.

This also means that without a "bup tick" before an index run, calls,
"bup save" might exit with non-zero exitcode when files/directories
are removed after bup index, but bup is not guaranteed to notice
missing files.

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
t/test-rm-between-index-and-save.sh