diff --git a/docs/man/borg-placeholders.1 b/docs/man/borg-placeholders.1 index 3e61b7922..ba7a631a7 100644 --- a/docs/man/borg-placeholders.1 +++ b/docs/man/borg-placeholders.1 @@ -42,6 +42,9 @@ The (short) hostname of the machine. .B {fqdn} The full name of the machine. .TP +.B {reverse-fqdn} +The full name of the machine in reverse domain name notation. +.TP .B {now} The current local date and time, by default in ISO\-8601 format. You can also supply your own \fI\%format string\fP, e.g. {now:%Y\-%m\-%d_%H:%M:%S} diff --git a/docs/usage/help.rst.inc b/docs/usage/help.rst.inc index c5fb6a71e..bed681768 100644 --- a/docs/usage/help.rst.inc +++ b/docs/usage/help.rst.inc @@ -169,6 +169,9 @@ placeholders: {fqdn} The full name of the machine. +{reverse-fqdn} + The full name of the machine in reverse domain name notation. + {now} The current local date and time, by default in ISO-8601 format. You can also supply your own `format string `_, e.g. {now:%Y-%m-%d_%H:%M:%S} diff --git a/setup.py b/setup.py index 891138ebe..1cd2bd006 100644 --- a/setup.py +++ b/setup.py @@ -651,6 +651,8 @@ class build_man(Command): examples = examples.replace(usage_include, '') examples = examples.replace('Examples\n~~~~~~~~', '') examples = examples.replace('Miscellaneous Help\n------------------', '') + examples = examples.replace('``docs/misc/prune-example.txt``:', '``docs/misc/prune-example.txt``.') + examples = examples.replace('.. highlight:: none\n', '') # we don't support highlight examples = re.sub('^(~+)$', lambda matches: '+' * len(matches.group(0)), examples, flags=re.MULTILINE) examples = examples.strip() if examples: diff --git a/src/borg/_chunker.c b/src/borg/_chunker.c index b72f6bd8b..4add32ac3 100644 --- a/src/borg/_chunker.c +++ b/src/borg/_chunker.c @@ -63,7 +63,7 @@ static uint32_t table_base[] = 0xc5ae37bb, 0xa76ce12a, 0x8150d8f3, 0x2ec29218, 0xa35f0984, 0x48c0647e, 0x0b5ff98c, 0x71893f7b }; -#define BARREL_SHIFT(v, shift) ( ((v) << shift) | ((v) >> ((32 - shift) & 0x1f)) ) +#define BARREL_SHIFT(v, shift) ( ((v) << (shift)) | ((v) >> ((32 - (shift)) & 0x1f)) ) size_t pagemask; diff --git a/src/borg/_hashindex.c b/src/borg/_hashindex.c index 9fbd1ebda..c7a5b0d0f 100644 --- a/src/borg/_hashindex.c +++ b/src/borg/_hashindex.c @@ -71,7 +71,7 @@ static int hash_sizes[] = { #define EMPTY _htole32(0xffffffff) #define DELETED _htole32(0xfffffffe) -#define BUCKET_ADDR(index, idx) (index->buckets + (idx * index->bucket_size)) +#define BUCKET_ADDR(index, idx) (index->buckets + ((idx) * index->bucket_size)) #define BUCKET_MATCHES_KEY(index, idx, key) (memcmp(key, BUCKET_ADDR(index, idx), index->key_size) == 0) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 9bc5db614..b2db6cc98 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -2093,6 +2093,9 @@ class Archiver: {fqdn} The full name of the machine. + {reverse-fqdn} + The full name of the machine in reverse domain name notation. + {now} The current local date and time, by default in ISO-8601 format. You can also supply your own `format string `_, e.g. {now:%Y-%m-%d_%H:%M:%S} @@ -2202,7 +2205,12 @@ class Archiver: else: commands[args.topic].print_help() else: - parser.error('No help available on %s' % (args.topic,)) + msg_lines = [] + msg_lines += ['No help available on %s.' % args.topic] + msg_lines += ['Try one of the following:'] + msg_lines += [' Commands: %s' % ', '.join(sorted(commands.keys()))] + msg_lines += [' Topics: %s' % ', '.join(sorted(self.helptext.keys()))] + parser.error('\n'.join(msg_lines)) return self.exit_code def do_subcommand_help(self, parser, args): diff --git a/src/borg/helpers.py b/src/borg/helpers.py index e5f9de5ad..cb3e10cac 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -661,9 +661,11 @@ def format_line(format, data): def replace_placeholders(text): """Replace placeholders in text with their values.""" current_time = datetime.now() + fqdn = socket.getfqdn() data = { 'pid': os.getpid(), - 'fqdn': socket.getfqdn(), + 'fqdn': fqdn, + 'reverse-fqdn': '.'.join(reversed(fqdn.split('.'))), 'hostname': socket.gethostname(), 'now': DatetimeWrapper(current_time.now()), 'utcnow': DatetimeWrapper(current_time.utcnow()),