Subject: strange problem when installing xpkgwedge: install script issue; shell bug?
To: None <>
From: Georg Schwarz <>
List: tech-pkg
Date: 04/15/2006 23:32:30
When installing xpkgwedge on IRIX 5.3 I encounter the following error  
message (seems to be non-fatal):

+INSTALL: bad option(s)

I traced it back to the following line (/bin/ksh -x prefix added by me):

ksh -x /usr/people/schwarz/pkgsrc/pkgtools/xpkgwedge/work/.pkgdb/ 
INSTALL xpkgwedge-1.15 PRE-INSTALL

which yields:

+ /usr/people/schwarz/pkgsrc/pkgtools/xpkgwedge/work/.pkgdb/+INSTALL  
xpkgwedge-1.15 UNPACK
+INSTALL: bad option(s)
+ /usr/local/bin/test ! -x ./+USERGROUP

the respective code looks like this:

case ${STAGE} in
         # Unpack the helper scriptlets.
         ${SELF} ${PKGNAME} UNPACK
         # Require that necessary users and groups exist or else fail  
         # installation of the package.
         ${TEST} ! -x ./+USERGROUP ||
                 { ./+USERGROUP ADD ${PKG_METADATA_DIR}
                   if ./+USERGROUP CHECK-ADD ${PKG_METADATA_DIR}; then

Now the funny this is if I do

  cp /usr/people/schwarz/pkgsrc/pkgtools/xpkgwedge/work/.pkgdb/ 
+INSTALL /usr/people/schwarz/pkgsrc/pkgtools/xpkgwedge/work/.pkgdb/ 

and then call
ksh -x /usr/people/schwarz/pkgsrc/pkgtools/xpkgwedge/work/.pkgdb/ 
XXXinstallXXX xpkgwedge-1.15 PRE-INSTALL

the problem does not show up. Could that be an obscure shell bug? The  
issue does not show up either when using /bin/sh instead of /bin/ksh.

I traced it down to the following:

lorenz 193% cd /var/tmp
lorenz 194% cat > ./+INSTALL
echo $SELF
lorenz 195% chmod a+x ./+INSTALL
lorenz 196% ./+INSTALL | head -3
lorenz 197% `pwd`/+INSTALL | head -3
+INSTALL: bad option(s)

further investigations yielded:

lorenz 198% mv ./+INSTALL ./+INSTALL1
lorenz 199% `pwd`/+INSTALL1 | head -3
+INSTALL1: bad option(s)
lorenz 200% mv ./+INSTALL1 ./+IN
lorenz 201% `pwd`/+IN | head -3
+IN: bad option(s)
lorenz 202% mv ./+IN ./+qq
lorenz 203% `pwd`/+qq | head -3
+qq: bad option(s)
lorenz 204% mv ./+qq ./qq
lorenz 205% `pwd`/qq | head -3

looks like although $0 is the full path for the first invocation it  
no longer is for any consecutive.

On my imac it works as expected:

imac:/var/tmp schwarz$ `pwd`/qq |head -3

and so it does on IRIX 6.5.
So looks like this is a bug in the old ksh of IRIX 5.3. Maybe other  
OSes are also affected?
Unfortunately pkgsrc/mk/install/install makes use of such recursive  

Georg Schwarz  +49 178 8545053