瀏覽代碼

rephrase some warnings, fixes #5164

borg check --repair and borg recreate are now present in the code
since rather long, so they are not experimental any more.

but, both bear some risk of data loss:
- there could be an undiscovered bug in the code
- the user might use them wrong (e.g. accidentally excluding everything /
  not matching anything when recreating an archive)
- there might be kinds of corruption borg check --repair can not fix
  and it might make things even worse while trying to fix.

so, if your repo / archive(s) are important, be careful.
Thomas Waldmann 5 年之前
父節點
當前提交
c0d6c33a09
共有 2 個文件被更改,包括 18 次插入6 次删除
  1. 2 2
      docs/internals/frontends.rst
  2. 16 4
      src/borg/archiver.py

+ 2 - 2
docs/internals/frontends.rst

@@ -574,8 +574,8 @@ Prompts
     BORG_RELOCATED_REPO_ACCESS_IS_OK
     BORG_RELOCATED_REPO_ACCESS_IS_OK
         For "Warning: The repository at location ... was previously located at ..."
         For "Warning: The repository at location ... was previously located at ..."
     BORG_CHECK_I_KNOW_WHAT_I_AM_DOING
     BORG_CHECK_I_KNOW_WHAT_I_AM_DOING
-        For "Warning: 'check --repair' is an experimental feature that might result in data loss."
+        For "This is a potentially dangerous functionality..." (check --repair)
     BORG_DELETE_I_KNOW_WHAT_I_AM_DOING
     BORG_DELETE_I_KNOW_WHAT_I_AM_DOING
         For "You requested to completely DELETE the repository *including* all archives it contains:"
         For "You requested to completely DELETE the repository *including* all archives it contains:"
     BORG_RECREATE_I_KNOW_WHAT_I_AM_DOING
     BORG_RECREATE_I_KNOW_WHAT_I_AM_DOING
-        For "recreate is an experimental feature."
+        For "This is a potentially dangerous functionality..." (recreate)

+ 16 - 4
src/borg/archiver.py

@@ -323,8 +323,11 @@ class Archiver:
     def do_check(self, args, repository):
     def do_check(self, args, repository):
         """Check repository consistency"""
         """Check repository consistency"""
         if args.repair:
         if args.repair:
-            msg = ("'check --repair' is an experimental feature that might result in data loss." +
-                   "\n" +
+            msg = ("This is a potentially dangerous functionality.\n"
+                   "check --repair might lead to data loss (in case of bugs or for kinds of\n"
+                   "corruption it is not capable of dealing with).\n"
+                   "BE VERY CAREFUL!\n"
+                   "\n"
                    "Type 'YES' if you understand this and want to continue: ")
                    "Type 'YES' if you understand this and want to continue: ")
             if not yes(msg, false_msg="Aborting.", invalid_msg="Invalid answer, aborting.",
             if not yes(msg, false_msg="Aborting.", invalid_msg="Invalid answer, aborting.",
                        truish=('YES', ), retry=False,
                        truish=('YES', ), retry=False,
@@ -1708,7 +1711,10 @@ class Archiver:
     @with_repository(cache=True, exclusive=True, compatibility=(Manifest.Operation.CHECK,))
     @with_repository(cache=True, exclusive=True, compatibility=(Manifest.Operation.CHECK,))
     def do_recreate(self, args, repository, manifest, key, cache):
     def do_recreate(self, args, repository, manifest, key, cache):
         """Re-create archives"""
         """Re-create archives"""
-        msg = ("recreate is an experimental feature.\n"
+        msg = ("This is a potentially dangerous functionality.\n"
+               "recreate might lead to data loss (if used wrongly or in case of bugs).\n"
+               "BE VERY CAREFUL!\n"
+               "\n"
                "Type 'YES' if you understand this and want to continue: ")
                "Type 'YES' if you understand this and want to continue: ")
         if not yes(msg, false_msg="Aborting.", truish=('YES',),
         if not yes(msg, false_msg="Aborting.", truish=('YES',),
                    env_var_override='BORG_RECREATE_I_KNOW_WHAT_I_AM_DOING'):
                    env_var_override='BORG_RECREATE_I_KNOW_WHAT_I_AM_DOING'):
@@ -3047,6 +3053,10 @@ class Archiver:
         check_epilog = process_epilog("""
         check_epilog = process_epilog("""
         The check command verifies the consistency of a repository and the corresponding archives.
         The check command verifies the consistency of a repository and the corresponding archives.
 
 
+        check --repair is a potentially dangerous functionality and might lead to data loss
+        (in case of bugs or for kinds of corruption it is not capable of dealing with).
+        BE VERY CAREFUL!
+
         First, the underlying repository data files are checked:
         First, the underlying repository data files are checked:
 
 
         - For all segments, the segment magic header is checked.
         - For all segments, the segment magic header is checked.
@@ -3949,7 +3959,9 @@ class Archiver:
         recreate_epilog = process_epilog("""
         recreate_epilog = process_epilog("""
         Recreate the contents of existing archives.
         Recreate the contents of existing archives.
 
 
-        This is an *experimental* feature. Do *not* use this on your only backup.
+        recreate is a potentially dangerous functionality and might lead to data loss
+        (if used wrongly or in case of bugs).
+        BE VERY CAREFUL!
 
 
         ``--exclude``, ``--exclude-from``, ``--exclude-if-present``, ``--keep-exclude-tags``
         ``--exclude``, ``--exclude-from``, ``--exclude-if-present``, ``--keep-exclude-tags``
         and PATH have the exact same semantics as in "borg create", but they only check
         and PATH have the exact same semantics as in "borg create", but they only check