Subject: bin/20495: Add bzip2 compression to pax
To: None <gnats-bugs@gnats.netbsd.org>
From: None <soren@blef.org>
List: netbsd-bugs
Date: 02/26/2003 03:37:47
>Number:         20495
>Category:       bin
>Synopsis:       Add bzip2 compression to pax
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 25 19:33:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Soren Jacobsen
>Release:        NetBSD 1.6O
>Organization:
	
>Environment:
	
	
System: NetBSD monstar 1.6O NetBSD 1.6O (MONSTAR) #0: Sun Feb 23 14:34:10 PST 2003 root@monstar:/usr/obj/sys/arch/i386/compile/MONSTAR i386
Architecture: i386
Machine: i386
>Description:
It would be nice to be able to use bzip2 for compressing archives.
>How-To-Repeat:
N/A
>Fix:
Apply this patch.


Index: options.c
===================================================================
RCS file: /cvsroot/src/bin/pax/options.c,v
retrieving revision 1.62
diff -u -r1.62 options.c
--- options.c	2003/02/25 13:37:00	1.62
+++ options.c	2003/02/26 03:28:06
@@ -229,7 +229,7 @@
 	 * process option flags
 	 */
 	while ((c = getopt_long(argc, argv,
-	    "ab:cdf:iklno:p:rs:tuvwx:zAB:DE:G:HLMN:OPT:U:XYZ",
+	    "ab:cdf:ijklno:p:rs:tuvwx:zAB:DE:G:HLMN:OPT:U:XYZ",
 	    pax_longopts, NULL)) != -1) {
 		switch (c) {
 		case 'a':
@@ -276,6 +276,13 @@
 			iflag = 1;
 			flg |= IF;
 			break;
+		case 'j':
+			/*
+			 * pass through bzip2
+			 */
+			jflag = 1;
+			gzip_program = BZIP2_CMD;
+			break;
 		case 'k':
 			/*
 			 * do not clobber files that exist
@@ -1930,20 +1937,20 @@
 pax_usage(void)
 {
 	fprintf(stderr,
-"Usage: pax [-cdnvzO] [-E limit] [-f archive] [-N dbdir] [-s replstr] ...\n"
+"Usage: pax [-cdjnvzO] [-E limit] [-f archive] [-N dbdir] [-s replstr] ...\n"
 "           [-U user] ... [-G group] ... [-T [from_date][,to_date]] ...\n"
 "           [pattern ...]\n");
 	fprintf(stderr,
-"       pax -r [-cdiknuvzADOYZ] [-E limit] [-f archive] [-N dbdir]\n"
+"       pax -r [-cdijknuvzADOYZ] [-E limit] [-f archive] [-N dbdir]\n"
 "           [-o options] ... [-p string] ... [-s replstr] ... [-U user] ...\n"
 "           [-G group] ... [-T [from_date][,to_date]] ... [pattern ...]\n");
 	fprintf(stderr,
-"       pax -w [-dituvzAHLMOPX] [-b blocksize] [[-a] [-f archive]] [-x format]\n"
+"       pax -w [-dijtuvzAHLMOPX] [-b blocksize] [[-a] [-f archive]] [-x format]\n"
 "           [-B bytes] [-N dbdir] [-o options] ... [-s replstr] ...\n"
 "           [-U user] ... [-G group] ...\n"
 "           [-T [from_date][,to_date][/[c][m]]] ... [file ...]\n");
 	fprintf(stderr,
-"       pax -r -w [-diklntuvzADHLMOPXYZ] [-N dbdir] [-p string] ...\n"
+"       pax -r -w [-dijklntuvzADHLMOPXYZ] [-N dbdir] [-p string] ...\n"
 "           [-s replstr] ... [-U user] ... [-G group] ...\n"
 "           [-T [from_date][,to_date][/[c][m]]] ... [file ...] directory\n");
 	exit(1);
Index: pax.1
===================================================================
RCS file: /cvsroot/src/bin/pax/pax.1,v
retrieving revision 1.39
diff -u -r1.39 pax.1
--- pax.1	2003/02/25 10:34:40	1.39
+++ pax.1	2003/02/26 03:28:06
@@ -45,7 +45,7 @@
 .Nd read and write file archives and copy directory hierarchies
 .Sh SYNOPSIS
 .Nm
-.Op Fl cdnvzO
+.Op Fl cdjnvzO
 .Bk -words
 .Op Fl E Ar limit
 .Ek
@@ -80,7 +80,7 @@
 .Op Ar pattern ...\&
 .Nm
 .Fl r
-.Op Fl cdiknuvzADOYZ
+.Op Fl cdijknuvzADOYZ
 .Bk -words
 .Op Fl E Ar limit
 .Ek
@@ -123,7 +123,7 @@
 .Op Ar pattern ...\&
 .Nm
 .Fl w
-.Op Fl dituvzAHLMOPX
+.Op Fl dijtuvzAHLMOPX
 .Bk -words
 .Op Fl b Ar blocksize
 .Ek
@@ -171,7 +171,7 @@
 .Nm
 .Fl r
 .Fl w
-.Op Fl diklntuvzADHLMOPXYZ
+.Op Fl dijklntuvzADHLMOPXYZ
 .Bk -words
 .Op Fl N Ar dbdir
 .Ek
@@ -508,6 +508,10 @@
 is encountered when reading a response or if
 .Pa /dev/tty
 cannot be opened for reading and writing.
+.It Fl j
+Use
+.Xr bzip2 1
+for compression when reading or writing archive files.
 .It Fl k
 Do not overwrite existing files.
 .It Fl l
>Release-Note:
>Audit-Trail:
>Unformatted: