]> arthur.barton.de Git - bup.git/commitdiff
Merge branch 'master' of git://github.com/thatch/bup
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 8 May 2011 07:13:48 +0000 (03:13 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 8 May 2011 07:13:48 +0000 (03:13 -0400)
* 'master' of git://github.com/thatch/bup:
  Missing space in optspec
  Fix a bug where marginally old files couldn't be stored in the index
  Show better errors with out-of-range Entry values

cmd/save-cmd.py
lib/bup/index.py
lib/bup/t/tindex.py

index b25b5aca67e294dd004a8d98039ff120c1c133a1..b00635a29691f62812dc5ccc08b603c634712454 100755 (executable)
@@ -20,7 +20,7 @@ bwlimit=   maximum bytes/sec to transmit to server
 f,indexfile=  the name of the index file (normally BUP_DIR/bupindex)
 strip      strips the path to every filename given
 strip-path= path-prefix to be stripped when saving
-graft=     a graft point *old_path*=*new_path* (can be used morethan once)
+graft=     a graft point *old_path*=*new_path* (can be used more than once)
 """
 o = options.Options(optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
index b7e65dd422357d71525326a1f9d70788cb736dab..0007bbc02c31023fb309446219447b20eaca79c2 100644 (file)
@@ -8,7 +8,7 @@ INDEX_HDR = 'BUPI\0\0\0\2'
 # FIXME: guess I should have used 64-bit integers to store the mtime/ctime.
 # NTFS mtime=0 corresponds to the year 1600, which can't be stored in a 32-bit
 # time_t.  Next time we update the bupindex format, keep that in mind.
-INDEX_SIG = '!IIIIIQII20sHII'
+INDEX_SIG = '!IiiIIQII20sHII'
 
 ENTLEN = struct.calcsize(INDEX_SIG)
 FOOTER_SIG = '!Q'
@@ -88,7 +88,7 @@ class Entry:
                            self.uid, self.gid, self.size, self.mode,
                            self.gitmode, self.sha, self.flags,
                            self.children_ofs, self.children_n)
-        except DeprecationWarning, e:
+        except (DeprecationWarning, struct.error), e:
             log('pack error: %s (%r)\n' % (e, self))
             raise
 
index 4b9e16ab2da7c3bd06db481c3fb25dda62729e3e..5d7f02d3bc7b340f6049d6bc7cac94902b1f34ae 100644 (file)
@@ -1,4 +1,5 @@
 import os
+import time
 from bup import index
 from bup.helpers import *
 import bup.xstat as xstat
@@ -45,6 +46,26 @@ def eget(l, ename):
         if e.name == ename:
             return e
 
+@wvtest
+def index_negative_timestamps():
+    # Makes 'foo' exist
+    f = file('foo', 'wb')
+    f.close()
+
+    # Dec 31, 1969
+    os.utime("foo", (-86400, -86400))
+    e = index.BlankNewEntry("foo")
+    e.from_stat(xstat.stat("foo"), time.time())
+    assert len(e.packed())
+    WVPASS()
+
+    # Jun 10, 1893
+    os.utime("foo", (-0x90000000, -0x90000000))
+    e = index.BlankNewEntry("foo")
+    e.from_stat(xstat.stat("foo"), time.time())
+    assert len(e.packed())
+    WVPASS()
+
 
 @wvtest
 def index_dirty():