bpo-32713: Fix tarfile.itn for large/negative float values. (GH-5434)
[python-delta-tar] / backup.py
index 06d541d..c583790 100644 (file)
--- a/backup.py
+++ b/backup.py
@@ -24,6 +24,7 @@ import os
 import re
 import random
 import shutil
+import sys
 from datetime import datetime
 from functools import partial
 
@@ -95,7 +96,10 @@ if __name__ == "__main__":
     parser.add_argument("-r", "--restore", action='store_true',
                         help="Restore a backup.")
     parser.add_argument("-R", "--recover", action='store_true',
-                        help="Restore a backup with an index file.")
+                        help="Recover a potentially damaged backup with an index "
+                        "file. **Caution**: recovery mode is insecure; it ignores "
+                        "data integrity checks on encrypted backup sets which may "
+                        "allow unauthorized decryption of confidential information.")
     parser.add_argument("-f", "--full", action='store_true',
                         help="Create a full backup.")
     parser.add_argument("-d", "--diff", action='store_true',
@@ -146,9 +150,11 @@ if __name__ == "__main__":
         else:
             deltatar.restore_backup(args.targetpath, backup_tar_path=args.sourcepath)
     elif args.recover:
+        if args.sourcepath is not None:
+            print("Disaster recovery conflicts with --sourcepath; please supply"
+                  " an\nindex file (--indexes).", file=sys.stderr)
         failed = deltatar.recover_backup(args.targetpath,
-                                         backup_indexes_paths=args.indexes,
-                                         backup_tar_path=args.sourcepath)
+                                         backup_indexes_paths=args.indexes)
         if len (failed) > 0:
             logger = logging.getLogger('deltatar.DeltaTar')
             print ("%d files could not be restored:" % len (failed))
@@ -158,7 +164,6 @@ if __name__ == "__main__":
     elif args.equals:
         check_equal_dirs(os.path.abspath(args.sourcepath), os.path.abspath(args.targetpath), deltatar)
     else:
-        import sys
         print("Nothing to do.\nPlease specify one of --full, --diff, --list-files, "
               "--restore, --equals.\n", file=sys.stderr)
         parser.print_help(file=sys.stderr)