Re: dump cannot do incremental backups when device name is too long

2011-12-31 Thread Martin Sugioarto
Am Sun, 11 Sep 2011 10:54:17 +0200
schrieb Martin Sugioarto mar...@sugioarto.com:

 Synopsis: [patch] dump(8) cannot do incremental backups when device
 name is too long
 
 State-Changed-From-To: open-patched
 State-Changed-By: mckusick
 State-Changed-When: Fri Oct 21 22:49:35 UTC 2011
 State-Changed-Why: 
 A patch has been applied to head.
 It will be MFC'ed after appropriate burnin time.
 
 http://www.freebsd.org/cgi/query-pr.cgi?pr=160678

Hi all,

can someone add this patch (not my version, but the one Mr McKusick
posted) to the future release branch? I tested it for a long time now
and didn't have any problems.

Thank you.

--
Martin


signature.asc
Description: PGP signature


Re: dump cannot do incremental backups when device name is too long

2011-09-12 Thread Martin Sugioarto

Hi all,

I added this to the PR DB, because it was requested:
http://www.freebsd.org/cgi/query-pr.cgi?pr=160678

Cc to freebsd-geom.

Original report on freebsd-current:
http://freebsd.1045724.n5.nabble.com/dump-cannot-do-incremental-backups-when-device-name-is-too-long-td4791131.html

--
Martin Sugioarto


signature.asc
Description: PGP signature


dump cannot do incremental backups when device name is too long

2011-09-11 Thread Martin Sugioarto

Hi all,

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.

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.

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.

--
Martin


--- /usr/src/sbin/dump/dump.h	2008-05-24 07:20:46.0 +0200
+++ dump.h	2011-09-11 10:32:49.0 +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);
 


signature.asc
Description: PGP signature