From owner-freebsd-bugs@FreeBSD.ORG Wed Aug 10 22:40:08 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BE171065673 for ; Wed, 10 Aug 2011 22:40:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3595C8FC15 for ; Wed, 10 Aug 2011 22:40:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7AMe8Dq063968 for ; Wed, 10 Aug 2011 22:40:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7AMe8P2063967; Wed, 10 Aug 2011 22:40:08 GMT (envelope-from gnats) Resent-Date: Wed, 10 Aug 2011 22:40:08 GMT Resent-Message-Id: <201108102240.p7AMe8P2063967@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stephen Montgomery-Smith Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D7A5106564A for ; Wed, 10 Aug 2011 22:39:41 +0000 (UTC) (envelope-from stephen@wilberforce.math.missouri.edu) Received: from wilberforce.math.missouri.edu (wilberforce.math.missouri.edu [128.206.184.213]) by mx1.freebsd.org (Postfix) with ESMTP id D2D488FC19 for ; Wed, 10 Aug 2011 22:39:39 +0000 (UTC) Received: from wilberforce.math.missouri.edu (localhost [127.0.0.1]) by wilberforce.math.missouri.edu (8.14.4/8.14.4) with ESMTP id p7AMdd7b033364 for ; Wed, 10 Aug 2011 17:39:39 -0500 (CDT) (envelope-from stephen@wilberforce.math.missouri.edu) Received: (from stephen@localhost) by wilberforce.math.missouri.edu (8.14.4/8.14.4/Submit) id p7AMdcCn033363; Wed, 10 Aug 2011 17:39:39 -0500 (CDT) (envelope-from stephen) Message-Id: <201108102239.p7AMdcCn033363@wilberforce.math.missouri.edu> Date: Wed, 10 Aug 2011 17:39:39 -0500 (CDT) From: Stephen Montgomery-Smith To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/159665: ctm does not work with bzip2 or xz compressed files. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Stephen Montgomery-Smith List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 22:40:08 -0000 >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: