From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 28 17:28:31 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0257137B401 for ; Fri, 28 Mar 2003 17:28:31 -0800 (PST) Received: from rwcrmhc53.attbi.com (rwcrmhc53.attbi.com [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 450B243FCB for ; Fri, 28 Mar 2003 17:28:30 -0800 (PST) (envelope-from bmah@employees.org) Received: from bmah.dyndns.org (12-240-204-110.client.attbi.com[12.240.204.110]) by rwcrmhc53.attbi.com (rwcrmhc53) with ESMTP id <20030329012829053005kul4e>; Sat, 29 Mar 2003 01:28:29 +0000 Received: from intruder.bmah.org (localhost [127.0.0.1]) by bmah.dyndns.org (8.12.8/8.12.8) with ESMTP id h2T1STv5032988; Fri, 28 Mar 2003 17:28:29 -0800 (PST) (envelope-from bmah@intruder.bmah.org) Received: (from bmah@localhost) by intruder.bmah.org (8.12.8/8.12.8/Submit) id h2T1SSJp032987; Fri, 28 Mar 2003 17:28:28 -0800 (PST) Date: Fri, 28 Mar 2003 17:28:28 -0800 From: "Bruce A. Mah" To: Tim Kientzle Message-ID: <20030329012828.GA32891@intruder.bmah.org> References: <3E42C148.4050807@acm.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KsGdsel6WgEHnImy" Content-Disposition: inline In-Reply-To: <3E42C148.4050807@acm.org> User-Agent: Mutt/1.4.1i X-Image-Url: http://www.employees.org/~bmah/Images/bmah-cisco-small.gif X-url: http://www.employees.org/~bmah/ cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Making pkg_XXX tools smarter about file types... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Mar 2003 01:28:32 -0000 --KsGdsel6WgEHnImy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable If memory serves me right, Tim Kientzle wrote: > The attached patch modifies the pkg_install > tools to inspect the file contents--rather than the > filename extension--to determine the > compression method in use. It then feeds the data > into the correct invocation of 'tar'. > I've also modified exec.c/lib.h to > factor out and expose some common code that > formats shell command lines. >=20 > This approach makes it possible, for instance, to > fix a single file extension (e.g. '.freebsd' > or '.package') that would not have to change > even if the internal format of a package were > to change (as has already occurred once, with > the transition from gzip to bzip2 compression). >=20 > Note that this could also be fairly easily extended > to support a variety of alternative archive > types. (E.g., the pkg_XXX tools could be > modified to support 'zip' or 'tar' archives > transparently to the user.) (A month and a half passes...I meant to get back to you earlier but didn't have any time to play with this before. Actually I still don't, but...) The concept is good, and it's something we've needed for awhile. I suspect you followed the various adventures of pkg_add and sysinstall when we tried supporting both bzip2 and gzip packages for various releases and developer previews, before we settled on the current "bzip2 for 5.X and gzip for 4.X" as something that actually worked. A little feedback on the patch itself (functionality only): Basically, it works great for the case of a package coming in on stdin. If the package comes from a file, then pkg_add wants to make two passes over the package, first to get the +CONTENTS file and second to actually unpack everything. When the first tar process finishes reading the +CONTENTS file, it closes its pipe (due to the --fast-read argument). However, pkg_add still seems to be writing to the pipe...this seems to be bad. An example with pkg_add built with CFLAGS=3D-DDEBUG: tomcat:add# cat ~/tmp/bash.pkg | ./pkg_add - Piping package '-' to cmd 'tar -xpjf - ' updating /etc/shells Executing /usr/sbin/mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null Executing mkdir /var/db/pkg/bash-2.05b.004 Executing chmod a+rx /var/db/pkg/bash-2.05b.004 Executing mv ./+DESC /var/db/pkg/bash-2.05b.004 Executing mv ./+COMMENT /var/db/pkg/bash-2.05b.004 Executing mv ./+MTREE_DIRS /var/db/pkg/bash-2.05b.004 Executing rm -rf /var/tmp/instmp.BGdXjm tomcat:add# ./pkg_add ~/tmp/bash.pkg Piping package '/usr/users/bmah/tmp/bash.pkg' to cmd 'tar -xpjf - --fast-re= ad - +CONTENTS' Broken pipe It works if I remove the --fast-read flag from the tar, but that's not the right answer. Bruce. --KsGdsel6WgEHnImy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+hPa72MoxcVugUsMRAilNAJ48GXwd1KIxnJbfs02MKBXocZMD2ACfTZI7 vVuJWX6DWbkyBrnVbh3BA7Q= =I+ts -----END PGP SIGNATURE----- --KsGdsel6WgEHnImy--