Use of xz instead of gzip

Stephen Montgomery-Smith stephen at missouri.edu
Wed Aug 10 03:06:08 UTC 2011


It seems that xz has much better compression than gzip.  How do people 
feel about moving CTM to use xz instead of gzip?

This will give about a 40% reduction in the size of the CTM files.  In 
particular, if I start putting SVN on CTM, this will save about 3G.

It requires two things:

First, the attached patch needs to be applied to /usr/src.  (Any 
committers willing to commit it?  It needs to MFC'ed rather quickly if I 
start using xz.)

Secondly, if your version of FreeBSD is old (like 7.x or older) you need 
to install the archivers/xz port.  If you don't, when you attempt to 
apply ctm to a "xz" compressed file, it replies with a rather helpful 
message "xz not found."

Stephen
-------------- next part --------------
diff -ur ~/FreeBSD-8/src/usr.sbin/ctm/ctm/ctm.c usr.sbin/ctm/ctm/ctm.c
--- /home/stephen/FreeBSD-8/src/usr.sbin/ctm/ctm/ctm.c	2011-08-09 16:38:22.000000000 -0500
+++ usr.sbin/ctm/ctm/ctm.c	2011-08-09 21:11:31.000000000 -0500
@@ -211,6 +211,12 @@
 	strcat(p,filename);
 	f = popen(p,"r");
 	if(!f) { warn("%s", p); return Exit_Garbage; }
+    } else if(p && !strcmp(p,".xz")) {
+	p = alloca(20 + strlen(filename));
+	strcpy(p,"xz -dc < ");
+	strcat(p,filename);
+	f = popen(p,"r");
+	if(!f) { warn("%s", p); return Exit_Garbage; }
     } else {
 	p = 0;
 	f = fopen(filename,"r");



More information about the ctm-users mailing list