Date: Sat, 27 Mar 1999 19:57:13 -0500 (EST) From: Chuck Robey <chuckr@mat.net> To: Jacques Vidrine <n@nectar.com> Cc: Doug Rabson <dfr@nlsystems.com>, Poul-Henning Kamp <phk@critter.freebsd.dk>, obrien@NUXI.com, Adrian Penisoara <ady@warpnet.ro>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: bzip2/tar/pkg_add (was Re: cvs commit: ports/news/tin ...) Message-ID: <Pine.BSF.4.10.9903271949000.25868-100000@picnic.mat.net> In-Reply-To: <199903280012.SAA93384@spawn.nectar.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 27 Mar 1999, Jacques Vidrine wrote: > On 27 March 1999 at 17:37, Doug Rabson <dfr@nlsystems.com> 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: I'd like to have bzcat, bunzip and bzip, and let tar be intelligent about which program to use to handle things. I would not want to modify the gzip/gunzip stuff, it's GNU, and I would simply like a little more definite line drawn between BSD code and GNU code. Besides, I think it somewhat more closely follows the tool philosophy, without losing functionality. No new flags to tar for decompression. For compression only, let tar depend on: 1) an added flag, for what kind of compression OR 2) environmental var, TAR_COMPRESSOR, which would be a path to the compressor to use, OR 3) a compiled in default, if no flag AND no env var is available. This would be the order checked. don't modify zcat. Add a bzcat. > > 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 > > ----------------------------+----------------------------------------------- Chuck Robey | Interests include any kind of voice or data chuckr@glue.umd.edu | communications topic, C programming, and Unix. 213 Lakeside Drive Apt T-1 | Greenbelt, MD 20770 | I run picnic (FreeBSD-current) (301) 220-2114 | and jaunt (Solaris7). ----------------------------+----------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9903271949000.25868-100000>