Package: dump
Version: 0.4b44-1
Severity: wishlist
Tags: patch upstream

Hello,

processing the output of restore -t (as amanda does) is much more
reliable, if the file names of the listing would be zero terminated,
instead of using a newline as terminator. (Newline can be part of the
filename and if the filename continues with "leaf 4711 …" it's not easy
to parse.

I've written a small patch and it would be great if this patch would
make it into debian and even the upstream.

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.6-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dump depends on:
ii  e2fslibs      1.42.5-1
ii  libblkid1     2.20.1-5.3
ii  libc6         2.13-38
ii  libcomerr2    1.42.5-1
ii  libreadline6  6.2+dfsg-0.1
ii  libselinux1   2.1.9-5
ii  libtinfo5     5.9-10
ii  libuuid1      2.20.1-5.3
ii  tar           1.26+dfsg-0.1

dump recommends no packages.

dump suggests no packages.

-- no debconf information
--- dump-0.4b44.orig/restore/main.c	2009-06-18 11:42:12.000000000 +0200
+++ dump-0.4b44/restore/main.c	2013-03-20 22:39:36.905605953 +0100
@@ -92,6 +92,7 @@
 int	aflag = 0, bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
 int	hflag = 1, mflag = 1, Mflag = 0, Nflag = 0, Vflag = 0, zflag = 0;
 int	uflag = 0, lflag = 0, Lflag = 0, oflag = 0;
+int	nullflag = 0;		/* \0 terminated file names */
 int	ufs2flag = 0;
 char	*Afile = NULL;
 int	dokerberos = 0;
@@ -198,7 +199,7 @@
 #ifdef USE_QFA
 		"P:Q:"
 #endif
-		"Rrs:tT:uvVxX:y")) != -1)
+		"Rrs:tT:uvVxX:y0")) != -1)
 		switch(ch) {
 		case 'a':
 			aflag = 1;
@@ -343,6 +344,9 @@
 		case 'y':
 			yflag = 1;
 			break;
+		case '0':
+			nullflag = 1;
+			break;
 		default:
 			usage();
 		}
--- dump-0.4b44.orig/restore/restore.8.in	2009-06-18 11:42:12.000000000 +0200
+++ dump-0.4b44/restore/restore.8.in	2013-03-20 22:44:45.511062849 +0100
@@ -79,7 +79,7 @@
 [\fB\-T \fIdirectory\fR]
 .PP
 .B restore \-t
-[\fB\-cdhHklMNuvVy\fR]
+[\fB\-cdhHklMNuvV0y\fR]
 [\fB\-A \fIfile\fR]
 [\fB\-b \fIblocksize\fR]
 [\fB\-f \fIfile\fR]
@@ -264,6 +264,10 @@
 program.  See also the
 .B \-X
 option below.
+If the 
+.B \-0
+flag is used, the output is not line separated anymore, but the NULL
+byte is used as separator.
 .TP
 .B \-x
 The named files are read from the given media. If a named file matches a 
@@ -523,6 +527,12 @@
 (verbose) flag causes it to type the name of each file it treats preceded by 
 its file type.
 .TP
+.B \-0
+(zero terminated) flag causes the output lines to be zero terminated,
+not line feed terminated. This flag is recognized for 
+.B \-t
+(listing) only.
+.TP
 .B \-V
 Enables reading multi-volume non-tape mediums like CDROMs.
 .TP
--- dump-0.4b44.orig/restore/restore.c	2010-12-06 15:26:50.000000000 +0100
+++ dump-0.4b44/restore/restore.c	2013-03-20 22:33:44.463922398 +0100
@@ -100,9 +100,12 @@
 		fprintf(stdout, "%10lu\t%ld\t%lld\t%s\n", (unsigned long)ino, 
 			tnum, tpos, name);
 	}
-	else
+	else {
 #endif
-		fprintf(stdout, "%10lu\t%s\n", (unsigned long)ino, name);
+		fprintf(stdout, "%10lu\t%s", (unsigned long)ino, name);
+		if (nullflag) putchar('\0');
+		else putchar('\n');
+	}
 	return (descend);
 }
 
--- dump-0.4b44.orig/restore/restore.h	2007-02-22 21:12:50.000000000 +0100
+++ dump-0.4b44/restore/restore.h	2013-03-20 22:36:16.976654545 +0100
@@ -64,6 +64,7 @@
 extern int	vflag;		/* print out actions taken */
 extern int	yflag;		/* always try to recover from tape errors */
 extern int	zflag;		/* tape is in compressed format */
+extern int	nullflag;	/* \0 separated output in t mode */ 
 extern int	ufs2flag;	/* tape is a FreeBSD UFS2 dump */
 extern char*	bot_script;	/* beginning of tape script */
 /*

Reply via email to