From owner-cvs-all Sat Mar 27 16:17:37 1999 Delivered-To: cvs-all@freebsd.org Received: from cerebus.nectar.com (nectar-gw.nectar.com [204.0.249.101]) by hub.freebsd.org (Postfix) with ESMTP id 42E0F1517F; Sat, 27 Mar 1999 16:17:34 -0800 (PST) (envelope-from nectar@nectar.com) Received: (from smap@localhost) by cerebus.nectar.com (8.9.1/8.9.1) id SAA76247; Sat, 27 Mar 1999 18:12:52 -0600 (CST) (envelope-from nectar@nectar.com) Received: from spawn.nectar.com(10.0.0.101) by cerebus.nectar.com via smap (V2.1) id xma076245; Sat, 27 Mar 99 18:12:42 -0600 Received: from spawn.nectar.com (localhost [127.0.0.1]) by spawn.nectar.com (8.9.2/8.9.1) with ESMTP id SAA93384; Sat, 27 Mar 1999 18:12:39 -0600 (CST) (envelope-from nectar@spawn.nectar.com) Message-Id: <199903280012.SAA93384@spawn.nectar.com> X-Mailer: exmh version 2.0.2 2/24/98 X-Exmh-Isig-CompType: repl X-Exmh-Isig-Folder: lists/freebsd/cvs-committers X-PGP-RSAfprint: 00 F9 E6 A2 C5 4D 0A 76 26 8B 8B 57 73 D0 DE EE X-PGP-RSAkey: http://www.nectar.com/nectar-rsa.txt X-PGP-DSSfprint: AB2F 8D71 A4F4 467D 352E 8A41 5D79 22E4 71A2 8C73 X-PGP-DHfprint: 2D50 12E5 AB38 60BA AF4B 0778 7242 4460 1C32 F6B1 X-PGP-DH-DSSkey: http://www.nectar.com/nectar-dh-dss.txt From: Jacques Vidrine In-reply-to: References: Subject: bzip2/tar/pkg_add (was Re: cvs commit: ports/news/tin ...) Mime-Version: 1.0 Content-Type: text/plain To: Doug Rabson Cc: Poul-Henning Kamp , obrien@NUXI.com, Adrian Penisoara , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Date: Sat, 27 Mar 1999 18:12:38 -0600 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk On 27 March 1999 at 17:37, Doug Rabson wrote: > On Sat, 27 Mar 1999, Poul-Henning Kamp wrote: > > How hard would it be to make pkg_add aware of both formats and "DTRT" ? > And make 'tar xvfz' understand it too. Ideally, applications that decompress files (zcat et. al., tar, pkg_add) should work with compress'd, gzip'd, and bzip2'd files. Today, ``tar -zx'' will extract files that have been compressed with compress or gzip, because gunzip understands those formats (and others). Because pkg_add simply executes ``tar -zx'' on package files, they can be compressed in either format as well. To allow pkg_add and tar to use bzip2'd files, we could use one of the following solutions: a) Add a new flag to tar to decompress bzip2 files (already done in -CURRENT, ``tar -yx''), and frob pkg_add so that it will use ``tar -yx'' or ``tar -zx'' depending on the package file extension. This is easy to implement, but I don't like it much. It means more special cases in pkg_add and more tar flags for users to remember. b) Teach tar to use the correct decompression program based on file extension or file ``magic'' instead of using command line flags (the command line flags would still be needed to specify compression program when creating archives, of course). Then pkg_add would work magically. This is a reasonable solution, I think, though I haven't looked at tar to see how much trouble it might be. c) Teach gunzip to uncompress bzip2'd files. It already knows how to deal with compress'd and gzip'd files. One approach would be to link gzip with the bzip2 library. This loses for two reasons. It would require bzip2 to be in the base system. More importantly, you can't do it because the licenses are incompatible. Another approach would be to fork off bzip2 when needed. This seemed reasonable to me, so I spent 40 minutes to hack gzip to do exactly that. Unfortunately, I don't like the result. Because gzip sets up the file handling, if exec'ing bzip2 fails you will loose the file. Some more special checking could fix this, but it just gets uglier. d) Put our own ``zcat'' in the base system. It would use file magic to determine which of gzip, bzip2, or whatever else comes along to decompress a file. Modify our tar so that for decompressing archives, it uses our new ``zcat''. This seems cleanest to me. It can be extended with more file formats. It can be done so that ``zcat'', ``zmore'', ``zgrep'', ``tar'', ``pkg_add'' and whatever Just Work with a variety of compressed file types. It will also be able to give an informative message to users who have not yet installed bzip2, or theNextBestCompressionApp. I'd like to hear any comments before I go ahead and implement solution d. Jacques Vidrine / n@nectar.com / nectar@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message