bin/159665: ctm does not work with bzip2 or xz compressed files.
Stephen Montgomery-Smith
stephen at FreeBSD.org
Wed Aug 10 22:40:08 UTC 2011
>Number: 159665
>Category: bin
>Synopsis: ctm does not work with bzip2 or xz compressed files.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Aug 10 22:40:07 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Stephen Montgomery-Smith
>Release: FreeBSD 8.2-STABLE amd64
>Organization:
>Environment:
System: FreeBSD wilberforce 8.2-STABLE FreeBSD 8.2-STABLE #0: Sat May 28 09:40:58 CDT 2011 stephen at laptop5.gateway.2wire.net:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
I run the CTM creation computers. I would like to allow ctm to decompress bzip2'ed files and xz'ed files, as well as gzip'ed files.
>How-To-Repeat:
>Fix:
Apply this patch to src/usr.sbin/ctm/ctm/.
Since xz isn't part of early versions of FreeBSD (e.g. FreeBSD 7.x), I have added a comment to the man page, and a helpful error message to ctm.c.
diff -u ctm.1.orig ctm.1
--- ctm.1.orig 2011-08-10 17:04:53.000000000 -0500
+++ ctm.1 2011-08-10 17:06:01.000000000 -0500
@@ -52,8 +52,11 @@
You can pass a CTM delta on stdin, or you can give the
filename as an argument.
If you do the latter, you make life a lot
-easier for your self, since the program can accept gzip'ed files and
+easier for your self, since the program can accept gzip'ed,
+bzip2'ed, or xz'ed files and
since it will not have to make a temporary copy of your file.
+(If you pass it an xz'ed file, and xz is not part of your base system,
+you will have to install xz from the ports.)
You can
specify multiple deltas at one time, they will be processed one at a
time.
diff -u ctm.c.orig ctm.c
--- ctm.c.orig 2011-08-10 17:15:30.000000000 -0500
+++ ctm.c 2011-08-10 17:19:23.000000000 -0500
@@ -211,6 +211,22 @@
strcat(p,filename);
f = popen(p,"r");
if(!f) { warn("%s", p); return Exit_Garbage; }
+ } else if(p && !strcmp(p,".bz2")) {
+ p = alloca(20 + strlen(filename));
+ strcpy(p,"bzcat < ");
+ strcat(p,filename);
+ f = popen(p,"r");
+ if(!f) { warn("%s", p); return Exit_Garbage; }
+ } else if(p && !strcmp(p,".xz")) {
+ if (system("which -s xz") != 0) {
+ fprintf(stderr, "xz is not installed. You can install it from ports.\n");
+ return Exit_Garbage;
+ }
+ 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");
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list