Subject: Re: pkg/7076: "install" scripts are not working in pkg_install-19990119
To: None <hubertf@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: netbsd-bugs
Date: 03/03/1999 04:37:36
[ On , March 3, 1999 at 01:21:29 (-0000), hubertf@netbsd.org wrote: ]
> Subject: Re: pkg/7076
>
> Synopsis: "install" scripts are not working in pkg_install-19990119.
> 
> State-Changed-From-To: open-feedback
> State-Changed-By: hubertf
> State-Changed-When: Tue Mar 2 17:19:13 PST 1999
> State-Changed-Why: 
> 
> Need more input, see other mail.

Well, I'm fubar'd.  I got stuck on trying to solve this problem tonight
for some inexplicable reason, and now it's *way* past my bedtime, and
I'm more confused than I thought I was when I first stumbled on it this
afternoon.

I've managed to re-create the problem by re-building a "gv" package
fresh (using pkgsrc sup'ed as of the date in the original PR), on a
1.3.3 system (though I don't expect to see any difference on -current)
(i.e. the package was built on a 1.3.3 machine, and installed on
another, and both have the upgraded pkgtools).

So, I decided to set the execute bit on the "+INSTALL" script in the
package and try pkg_add again, but to my vast surprise it still failed!

04:21 [743] # pax -vzf gv-3.5.8.tgz +INSTALL 
-rwxr-xr-x  1 root     wheel        317 Sep  1  1998 +INSTALL
pax: ustar vol 1, 43 files, 499712 bytes read, 0 bytes written.

(note the execute permission above)

04:21 [744] # pkg_add -v gv-3.5.8.tgz           
Requested space: 874664 bytes, free space: 231011328 bytes in /var/tmp/instmp.28837a
Package `gv-3.5.8' depends on `Xaw3d-1.5'.
 - Xaw3d-1.5 already installed.
Package `gv-3.5.8' depends on `ghostscript-5.50'.
 - ghostscript-5.50 already installed.
Package `gv-3.5.8' depends on `png-1.0.2'.
 - png-1.0.2 already installed.
Running install with PRE-INSTALL for gv-3.5.8.
./+INSTALL: permission denied
pkg_add: install script returned error status
pkg_add: 1 package addition(s) failed

I also manually tested the script, and it works just fine; both with,
and without, using "sh -c".

(and yes, I am running pkg_add as "root")

So I finally peeked in the source.  First off I was dumbfounded to
discover that there were already "chmod +x" calls in all the right
places.  Then I was further dumbfounded to find that these scripts were
being invoked by system(3), which presumably still uses "/bin/sh -c
'ARGS'".

I'm too tired now to do further detailed debugging, but I can't quite
for the life of me imagine what's going wrong.

I think though that this new test confirms that the only variable here
is the upgrade to pkg_install-19990119.  I had previously built a "gv"
package and successfully installed it on this same 1.3.3 machine.  Now
neither that original package, nor a freshly built one, will install.
Unfortunately cursory diffs between the old pkg_add code and the new
code doesn't reveal any changes in what I would expect to be related
areas.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>