From 91991988e10b08fbc5d0517b4c6079a6b0462e74 Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Sat, 17 Dec 2016 18:00:03 +0100 Subject: [PATCH 1/2] Fix subsubparsers for Python <3.4.3 This works around http://bugs.python.org/issue9351 Since Debian and Ubuntu ship 3.4.2 and 3.4.0 respectively. --- borg/archiver.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/borg/archiver.py b/borg/archiver.py index 5ee612972..2cdfe37f3 100644 --- a/borg/archiver.py +++ b/borg/archiver.py @@ -1160,7 +1160,7 @@ class Archiver: help='manage repository key') key_parsers = subparser.add_subparsers(title='required arguments', metavar='') - subparser.set_defaults(func=functools.partial(self.do_subcommand_help, subparser)) + subparser.set_defaults(fallback_func=functools.partial(self.do_subcommand_help, subparser)) key_export_epilog = textwrap.dedent(""" If repository encryption is used, the repository is inaccessible @@ -1694,7 +1694,7 @@ class Archiver: help='debugging command (not intended for normal use)') debug_parsers = subparser.add_subparsers(title='required arguments', metavar='') - subparser.set_defaults(func=functools.partial(self.do_subcommand_help, subparser)) + subparser.set_defaults(fallback_func=functools.partial(self.do_subcommand_help, subparser)) debug_info_epilog = textwrap.dedent(""" This command displays some system information that might be useful for bug @@ -1902,11 +1902,13 @@ class Archiver: def run(self, args): os.umask(args.umask) # early, before opening files self.lock_wait = args.lock_wait - setup_logging(level=args.log_level, is_serve=args.func == self.do_serve) # do not use loggers before this! + # This works around http://bugs.python.org/issue9351 + func = getattr(args, 'func', None) or getattr(args, 'fallback_func') + setup_logging(level=args.log_level, is_serve=func == self.do_serve) # do not use loggers before this! check_extension_modules() if is_slow_msgpack(): logger.warning("Using a pure-python msgpack! This will result in lower performance.") - return args.func(args) + return func(args) def sig_info_handler(sig_no, stack): # pragma: no cover From 880578da064f1ddcd53fdee2c356529c75bcbca7 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 19 Dec 2016 16:06:54 +0100 Subject: [PATCH 2/2] quickstart: use prune with --list so people are better aware of what's happening, avoiding pitfalls with wrong or missing --prefix. --- docs/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 78966eb5e..58ce6c96f 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -126,7 +126,7 @@ certain number of old archives:: # archives of THIS machine. The '{hostname}-' prefix is very important to # limit prune's operation to this machine's archives and not apply to # other machine's archives also. - borg prune -v $REPOSITORY --prefix '{hostname}-' \ + borg prune -v --list $REPOSITORY --prefix '{hostname}-' \ --keep-daily=7 --keep-weekly=4 --keep-monthly=6 Pitfalls with shell variables and environment variables