Subject: pkg/23070: pkg_add failed under solaris : wrong tar command used
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <pierre.bourgin@pcotech.fr>
List: netbsd-bugs
Date: 10/06/2003 09:05:41
>Number:         23070
>Category:       pkg
>Synopsis:       pkg_add failed under solaris : wrong tar command used
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 06 09:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Pierre Bourgin
>Release:        SunOS-5.7/sparc
>Organization:
PCO Technologies
>Environment:
SunOS tequila 5.7 Generic_106541-20 sun4u sparc SUNW,Ultra-250

>Description:
I've just built bootstrap-pkgsrc-20030924 under Solaris-2.7/sparc: the
build is fine, but once installed, the command /usr/pkg/sbin/pkg_add
misteriously failed to add packages.

In fact, this is because uses the wrong tar command: instead of using
/usr/pkg/bin/tar, it's using 'tar' from $PATH environnment: in my case,
it will use solaris tar (/usr/bin/tar) instead of /usr/pkg/bin/tar
because my $PATH is something like "/usr/bin:/usr/pkg/bin" (in that order).

I've just built bootstrap-pkgsrc-20030924 under Solaris-2.7/sparc: the
build is fine, but once installed, the command /usr/pkg/sbin/pkg_add
misteriously failed to add packages.

In fact, this is because pkg_add uses the wrong tar command: instead of using /usr/pkg/bin/tar, it's using 'tar' from $PATH environnment: in my case, it will use solaris tar (/usr/bin/tar) instead of /usr/pkg/bin/tar
because my $PATH is something like "/usr/bin:/usr/pkg/bin" (in that order).

>How-To-Repeat:

build and intall bootstrap-pkgsrc-20030924,

once /usr/pkg/sbin/pkg_add installed, modify $PATH variable environnment 
with /usr/bin before  /usr/pkg/bin/tar : 'which tar' must return /usr/bin/tar, the tar command provided with Solaris

try to install a binary package with pkg_add will never succeed.


>Fix:
$ grep NetBSD bootstrap-pkgsrc-20030924/pkg_install/add/Makefile.in
# $NetBSD: Makefile.in,v 1.9 2003/09/23 14:04:31 grant Exp $

$ gdiff -bu bootstrap-pkgsrc-20030924/pkg_install/add/Makefile.in.orig \
            bootstrap-pkgsrc-20030924/pkg_install/add/Makefile.in

--- bootstrap-pkgsrc-20030924/pkg_install/add/Makefile.in.orig  Tue Sep 23 16:04:31 2003
+++ bootstrap-pkgsrc-20030924/pkg_install/add/Makefile.in       Mon Oct  6 10:10:43 2003
@@ -5,6 +5,9 @@
 prefix=                @prefix@
 exec_prefix=   @exec_prefix@
 sbindir=       @sbindir@
+
+tar=           @tar@
+
 mandir=                @mandir@

 man1dir=       $(mandir)/man1
@@ -14,7 +17,7 @@
 CCLD=          $(CC)
 LIBS=          -linstall @LIBS@
 CPPFLAGS=      @CPPFLAGS@ -I. -I$(srcdir) -I../lib
-DEFS=          @DEFS@ -DBINDIR=\"$(sbindir)\" -DMTREE_CMD=\"@mtree@\"
+DEFS=          @DEFS@ -DBINDIR=\"$(sbindir)\" -DMTREE_CMD=\"@mtree@\" -DTAR_CMD=\"$(tar)\"
 CFLAGS=                @CFLAGS@
 LDFLAGS=       @LDFLAGS@ -L../lib


>Release-Note:
>Audit-Trail:
>Unformatted: