bin/160678: dump cannot do incremental backups when device name is
martin at sugioarto.com
Mon Sep 12 13:30:15 UTC 2011
>Synopsis: dump cannot do incremental backups when device name is too long
>Arrival-Date: Mon Sep 12 13:30:14 UTC 2011
>Originator: Martin Sugioarto
FreeBSD 9.0-BETA2 #0: Wed Sep 7 21:53:50 CEST 2011
I've discovered a small bug in dump. When dump reads
the /etc/dumpdates, at the moment the device name in the first column is
restricted to 32 characters.
With todays GEOM implementation, it's easy to make longer device names.
My device is named: "/dev/mirror/encrypted.elig.journal". And it is
written to dumpdates as "/dev/mirror/encrypted.elig.journ". Next time
you use dump, it reads in the truncated device and internally it won't
match the current dump device. The delta won't be calculated and you
will get a level "0" dump again. Additionally, dump writes garbage in
second and third column because of wrong formatting.
Create long device names with GEOM. Try dump with level 0 backup and "-u" flag, then a higher level.
It's a pretty trivial fix, because only the format for printf and
sscanf causes the error (attached).
Let me explain the two line patch.
1) The input is extended from 32 to 256 characters.
2) I removed the width formatting from printf. You will get a fixed
column and it's hard to read. I am assuming that dump works correctly
and does not modify the device name anywhere.
Two remarks about the fix.
1) Please note, that fixed column output of /etc/dumpdates is not used anymore. I don't personally know any tools that parse this file, but they could possibly break. On the other hand, it is not possible to support longer file names for devices without breaking this support.
2) Since I don't like this kind of parsing generally (sscanf), you are free
to improve the implementation in these places. I wanted to fix it as
simply as possible this time.
Patch attached with submission follows:
--- /usr/src/sbin/dump/dump.h 2008-05-24 07:20:46.000000000 +0200
+++ dump.h 2011-09-11 10:32:49.000000000 +0200
@@ -171,9 +171,9 @@
if (ddatev != NULL) \
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
-#define DUMPOUTFMT "%-32s %d %s" /* for printf */
+#define DUMPOUTFMT "%s %d %s" /* for printf */
/* name, level, ctime(date) */
-#define DUMPINFMT "%32s %d %[^\n]\n" /* inverse for scanf */
+#define DUMPINFMT "%256s %d %[^\n]\n" /* inverse for scanf */
void sig(int signo);
More information about the freebsd-bugs