]> arthur.barton.de Git - bup.git/commitdiff
save: always push parents when entering a subtree
authorRob Browning <rlb@defaultvalue.org>
Tue, 4 Nov 2014 18:09:37 +0000 (12:09 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 31 Jan 2015 18:33:48 +0000 (12:33 -0600)
Once we enter the subtree, all of the parents must be on the stack for
subsequent operations to work correctly (like the _pop() in the
following "if not file:" section).

Consider the case where /some/empty/dir was indexed, but removed before
save.  Without this fix, the metadata read for "dir" would fail and the
pending directory stack (parts) would include /some/empty instead of
/some/empty/dir.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/save-cmd.py
t/test-rm-between-index-and-save.sh

index 93c693bc2265f1d98e7472bb767f3f14cb499ec3..6cd142f394c987549ac4864e10759e28d49c148c 100755 (executable)
@@ -325,8 +325,8 @@ for (transname,ent) in r.filter(extra, wantrecurse=wantrecurse_during):
         except (OSError, IOError), e:
             add_error(e)
             lastskip_name = dir_name
         except (OSError, IOError), e:
             add_error(e)
             lastskip_name = dir_name
-        else:
-           _push(dir_name, meta)
+            meta = metadata.Metadata()
+        _push(dir_name, meta)
 
     if not file:
         if len(parts) == 1:
 
     if not file:
         if len(parts) == 1:
index e93dd723291f482041d137b7ccdebcd0b9e45a4a..67c5b8ad89c22f341c9c43f70f8a53c92a21a34e 100755 (executable)
@@ -61,15 +61,16 @@ WVPASS rmdir "$D"/foo
 # with directories, bup notices that foo is missing, so it fails
 # (complete with delayed error)
 WVFAIL bup save -n save-fail-missing "$D"
 # with directories, bup notices that foo is missing, so it fails
 # (complete with delayed error)
 WVFAIL bup save -n save-fail-missing "$D"
-# ... so "foo" is absent from "bup ls"
+# ...but foo is still saved since it was just fine in the index
 WVPASSEQ "$(bup ls -AF save-fail-missing/latest/$TOP/$D/)" "bar/
 WVPASSEQ "$(bup ls -AF save-fail-missing/latest/$TOP/$D/)" "bar/
-baz/"
+baz/
+foo/"
 # Index again:
 WVPASS bup tick
 WVPASS bup index -ux "$D"
 # no non-zero-exitcode anymore:
 WVPASS bup save -n save-fail-missing "$D"
 # Index again:
 WVPASS bup tick
 WVPASS bup index -ux "$D"
 # no non-zero-exitcode anymore:
 WVPASS bup save -n save-fail-missing "$D"
-# foo is (still...) missing, of course:
+# foo is now gone
 WVPASSEQ "$(bup ls -AF save-fail-missing/latest/$TOP/$D/)" "bar/
 baz/"
 
 WVPASSEQ "$(bup ls -AF save-fail-missing/latest/$TOP/$D/)" "bar/
 baz/"