Date: Wed, 10 Aug 2011 17:39:39 -0500 (CDT) From: Stephen Montgomery-Smith <stephen@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/159665: ctm does not work with bzip2 or xz compressed files. Message-ID: <201108102239.p7AMdcCn033363@wilberforce.math.missouri.edu> Resent-Message-ID: <201108102240.p7AMe8P2063967@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108102239.p7AMdcCn033363>