]> arthur.barton.de Git - bup.git/blobdiff - cmd/save-cmd.py
Assume FS_IOC_GETFLAGS may trash output on error
[bup.git] / cmd / save-cmd.py
index 327d36677db12526ae115986e71941e3772ac62a..fce9aadc95659c36014c3032df309e865bb257aa 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 import sys, stat, time, math
 from cStringIO import StringIO
+from errno import EACCES
+
 from bup import hashsplit, git, options, index, client, metadata, hlinkdb
 from bup.helpers import *
 from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK
@@ -185,10 +187,13 @@ def progress_report(n):
 
 indexfile = opt.indexfile or git.repo('bupindex')
 r = index.Reader(indexfile)
-if not os.access(indexfile + '.meta', os.W_OK|os.R_OK):
-    log('error: cannot access "%s"; have you run bup index?' % indexfile)
+try:
+    msr = index.MetaStoreReader(indexfile + '.meta')
+except IOError, ex:
+    if ex.errno != EACCES:
+        raise
+    log('error: cannot access %r; have you run bup index?' % indexfile)
     sys.exit(1)
-msr = index.MetaStoreReader(indexfile + '.meta')
 hlink_db = hlinkdb.HLinkDB(indexfile + '.hlink')
 
 def already_saved(ent):
@@ -269,7 +274,8 @@ for (transname,ent) in r.filter(extra, wantrecurse=wantrecurse_during):
         continue
     if opt.smaller and ent.size >= opt.smaller:
         if exists and not hashvalid:
-            add_error('skipping large file "%s"' % ent.name)
+            if opt.verbose:
+                log('skipping large file "%s"\n' % ent.name)
             lastskip_name = ent.name
         continue