From owner-freebsd-current@FreeBSD.ORG Sun Sep 11 08:54:27 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAEDA106566C for ; Sun, 11 Sep 2011 08:54:27 +0000 (UTC) (envelope-from martin@sugioarto.com) Received: from mailserv.regfish.com (mailserv.regfish.com [79.140.61.33]) by mx1.freebsd.org (Postfix) with ESMTP id 3108B8FC12 for ; Sun, 11 Sep 2011 08:54:26 +0000 (UTC) Received: (qmail 22502 invoked from network); 11 Sep 2011 08:54:25 -0000 Received: from pd9ec0060.dip0.t-ipconnect.de (HELO yuni.sugioarto.com) (46959-0001@[217.236.0.96]) (envelope-sender ) by mailserv.regfish.com (qmail-ldap-1.03) with SMTP for ; 11 Sep 2011 08:54:25 -0000 Received: from zelda.sugioarto.com (zelda.sugioarto.com [192.168.0.12]) by yuni.sugioarto.com (Postfix) with ESMTP id A77421BAC57 for ; Sun, 11 Sep 2011 10:54:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sugioarto.com; s=mail; t=1315731263; bh=E6s0GpuatCR3CnKNBOF6apwdOI/Er+R4MiK65M/HQKw=; h=Date:From:To:Subject:Message-ID:Mime-Version:Content-Type; b=PFFzXEDjBJ29083iOPBRAsVhnqSv3H40qCsp1V49f4dyfHZGAuGJpuB7Vy3wG5APR BnbOOgryw4e4c3KPcXGFPLUPkGFWEA2auZjoTnKNQjCmwi+tsWlRDs+qBIh92H7zOf KXLfr9tpRrLQD+pjmRhtYueDc9rfzpcRTt9Y8cow= Date: Sun, 11 Sep 2011 10:54:17 +0200 From: Martin Sugioarto To: freebsd-current@freebsd.org Message-ID: <20110911105417.073a5300@zelda.sugioarto.com> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/723a5UJPbXf0XVfmjxuOohF"; protocol="application/pgp-signature" Subject: dump cannot do incremental backups when device name is too long X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2011 08:54:28 -0000 --Sig_/723a5UJPbXf0XVfmjxuOohF Content-Type: multipart/mixed; boundary="MP_/M.V/OSVJDHLgdl_yS5JSDT2" --MP_/M.V/OSVJDHLgdl_yS5JSDT2 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --MP_/M.V/OSVJDHLgdl_yS5JSDT2 Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=dump.h.diff --- /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 !=3D NULL) \ for (ddp =3D ddatev[i =3D 0]; i < nddates; ddp =3D ddatev[++i]) =20 -#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 */ =20 void sig(int signo); =20 --MP_/M.V/OSVJDHLgdl_yS5JSDT2-- --Sig_/723a5UJPbXf0XVfmjxuOohF Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) Comment: Anständige Signaturen und Verschlüsselung gibt es nur mit GNUpg Comment: und nicht mit De-Mail. iQIcBAEBAgAGBQJObHc+AAoJEF8wvLx/5p/7A2EP/jy+OTdT5Pn+bav5woZ/I2Fq breQWPfINlXBHlzob32piIi80eeXrLoQhAfEXBlOTRBSHunU1MKpdsWi7+2GmWD9 PPh7hDgOF9WlBIQpn0MuiJH4+UjWhsgJfyjXiQsOTYIAffft7hXHnWRxlVBcl9T1 m3NdOkjZht06kLT/N+c9opc3cQgF+XVIw3bHNwvDxCxTtDC5ZgLyZRp776WPmXhP gnHr6DmdzRQHtkCB6fHZwmTuQxys93B5Y/SQ6Jrq23YIpGS+rsu8wP4Zzcu/rsaG L7yCJVsyD+ce8vDb9BYbxuse/Xy2hjnCzE6Gs8UnXjdXO9GtBnEmxJrYudEjDnYf PhFiDhFskHekdNE3qT3GPzqwlif/pk/I1JrdrkhideWQiY2LTEojxq3PmDpEvLbP FILV+WGi1cVVq+pkzBbKRrjiBJYeQLfSq72XLMqw1RGLlvEsVX/vBp+XQZh6yb/o TGKi9C9kG8p6UfDcVHRi/0tsa+TE1JP0V+ZJV+3Xxfm+cxdScMAx2XuPl0uk31PC MUiDn4SbRPNXQw7IHLupEF782fnx5HcMaxmVGSA+lb8GRt8ukjE1zfFCm8/IRrvV uKmAoIoF+2RE2vVIgUFZ573w7V3xWXEkRXtfswaB2J9ng4/QEb51uashpuUYVxmT s2fUIvwxSEhcda0F80NB =06Hi -----END PGP SIGNATURE----- --Sig_/723a5UJPbXf0XVfmjxuOohF--