Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Mar 1999 18:12:38 -0600
From:      Jacques Vidrine <n@nectar.com>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, obrien@NUXI.com, Adrian Penisoara <ady@warpnet.ro>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   bzip2/tar/pkg_add (was Re: cvs commit: ports/news/tin ...)
Message-ID:  <199903280012.SAA93384@spawn.nectar.com>
In-Reply-To: <Pine.BSF.4.05.9903271736560.3322-100000@herring.nlsystems.com> 
References:  <Pine.BSF.4.05.9903271736560.3322-100000@herring.nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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:

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903280012.SAA93384>