THE bug

Miek Gieben <[email protected]> Thu, 30 Jun 2005 13:59:00 +0200
Newsgroups gmane.comp.sysutils.backup.hdup.general
Message-ID <[email protected]>
--cpvLTH7QU4gwfq3S
Content-Type: multipart/mixed; boundary="ZRyEpB+iJ+qUx0kp"
Content-Disposition: inline


--ZRyEpB+iJ+qUx0kp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,

hdup2 has one serious bug in that it doesn't store directory
information in the archives. This is due to a bug in tar :-(

Also see:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D302790

and:
http://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=3Dgieben&submit=3DSea=
rch%21&idxname=3Dbug-
tar&max=3D20&result=3Dnormal&sort=3Dscore

So the problem looks to be worked on at tar's side, but that is taking long=
=2E=20
So I've decided to take the plunge and try to fix it myself. In this mail
you'll find 2 patches. One for tar 1.15.1 (latest stable) and one against
hdup 2.0.8 (i use my 2.0.9 sources, but it should apply against 2.0.8 also).

The patch against tar fixes the thrice inclusion of files in the archives. =
It
does this in a stupid/dumb wayy, but it seems to work for hdup :-)

The patch against hdup enables 2 things; 1. add --no-recursion to the argum=
ents
passed to tar. 2. enable the writing of directory information in walker.c.

I'm pondering to add a flag to hdup's exe (-T (for tar) or -F (for fixed)) =
with
which you can signal that you use a patched tar. If this flag is given
the functionality of the patch above is enabled.

Note the stuff is NOT tested.  I'm also sending tar patch to bug-tar
to see if it gets included in gnu tar itself.

--
grtz,
  - Miek

http://www.miek.nl                      http://www.nlnetlabs.nl
PGP Key ID: 0xB18453A1
fingerprint: 002B B079 0DDA 7D44 2B5C  CAB0 C3B7 F943 B184 53A1

--ZRyEpB+iJ+qUx0kp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="hdup-tar.diff"
Content-Transfer-Encoding: quoted-printable

Index: src/hdup.h.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/hdup.h.in	(revision 103)
+++ src/hdup.h.in	(working copy)
@@ -22,15 +22,14 @@
 #define LZOP_PROG	"@lzop@"
 #define SPLIT_PROG      "@split@"
 #define UNSPLIT_PROG    "@cat@"
-#define ETCFILE         "@prefix@/etc/hdup/hdup.conf"
-/* /usr/local/etc#"/etc/hdup/hdup.conf") */
+#define ETCFILE         "@sysconfdir@/hdup/hdup.conf"
 #define REMOTE_HDUP     "@prefix@/sbin/hdup"
 #define REMOTE_HDUP_OPT ""      /* default is empty */
 #define FILELIST        "/filelist"
 #define MUTE            " 2>/dev/null"
-/* GT fix, added --no-recursion here MG 29-12-2004 */
-/*#define SPARSE	        " --sparse --no-recursion"*/
-#define SPARSE	        " --sparse "
+/* GT fix, added --no-recursion here MG 29-12-2004 hackish to add it here.=
*/
+#define SPARSE	        " --sparse --no-recursion"
+/* #define SPARSE	        " --sparse " */
 #define ONEFILE         " --one-file-system "
 #define TAR_CONF_OPT	""
 #define DATE_DEF        0
Index: src/walker.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/walker.c	(revision 103)
+++ src/walker.c	(working copy)
@@ -268,8 +268,6 @@
 				continue;
 			}
=20
-		=09
-
 			dirstack[di++] =3D g_strdup(newpath);
=20
 			if (di % dsize =3D=3D 0)=20
@@ -295,7 +293,8 @@
 	while (di > 0) {
 		pop =3D dirstack[--di];=20
 		/* GT fix - use tar --no-recursion to make the backup */
-		/*fprintf(fp, "%s\n", pop);*/
+		/* uncomment this if you have patched your tar */
+		fprintf(fp, "%s\n", pop);
 		total_find +=3D walk_dir(pop, fp, host, dexclude, fexclude, dinclude, fi=
nclude);
 		g_free(pop);
 	}

--ZRyEpB+iJ+qUx0kp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tar.diff"

--- tar-1.15.1/src/create.c     2004-10-04 11:21:31.000000000 +0200
+++ tar-1.15.1.local/src/create.c       2005-06-30 13:35:51.647593741 +0200
@@ -1175,7 +1175,14 @@
                          buffer = xrealloc (buffer, buffer_size);
                        }
                      strcpy (buffer + plen, q + 1);
-                     dump_file (buffer, -1, (dev_t) 0);
+                     /* Hack to make --listed-incremental and
+                      * --files-from and --no-recursion work;
+                      */
+                     if (!listed_incremental_option &&
+                                     !files_from_option &&
+                                     !recursion_option) {
+                             dump_file (buffer, -1, (dev_t) 0);
+                     }
                    }
                  q += qlen + 1;
                }

--ZRyEpB+iJ+qUx0kp--

--cpvLTH7QU4gwfq3S
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCw96Ew7f5Q7GEU6ERAh6wAJ4gLoE+t9BKJRUj7tAROK4WSKawMQCfeQGZ
niCnoZsG7uKF91UnRNXrceM=
=NWDY
-----END PGP SIGNATURE-----

--cpvLTH7QU4gwfq3S--