Problem "install-bits"-ing sidai-gen-utils to ia32-linux-rh7.2 host

"Gordon Allan" <[email protected]> Mon, 4 Feb 2002 18:13:34 -0000
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
Will, Matt et al,

My small team with 1x ia32-linux-rh7.2 and 2x solaris hosts had some problems
installing sidai-gen-utils scripts - the solaris boxes installed fine but the linux one
did not. I debugged and found some issues:

General symptoms:
====================
On solaris, all sidai-gen-utils scripts installed and revealed
On Linux, only the first one (add-license) worked, the rest did not install or reveal

I debugged... The ARK step which goes wrong is 'install-bits'....


gordon@[linuxbox].verilab.com : ark package install-bits sidai-gen-utils --verbose --hosts=.
# (I had previously taken all machines up as far as pre-install-bits during my debug)

> install-bits on sidai-gen-utils ( not done before )
  [FROM: code - sidai:package/local-scripts [v 1.6] ]
>> host: hagrid [for hosts: ia32-linux-rh7.2]
+ PKG_PROTO_HOST=ia32-linux-rh7.2
+ INSTALL=/usr/bin/install
+ MKDIR_P=/bin/mkdir -p
+ scripts=
+ prefix=/our/.-ark-deploy/sidai-gen-utils
+ bindir=/our/.-ark-deploy/sidai-gen-utils/bin
+ man1dir=/our/.-ark-deploy/sidai-gen-utils/man/man1
+ cd /d/ark-builds/sidai-gen-utils/ia32-linux-rh7.2
+ '[' '!' -f /our/.-ark-deploy/sidai-gen-utils/.-ark-deploy:install ']'
+ /bin/rm -rf /our/.-ark-deploy/sidai-gen-utils
+ /bin/mkdir -p /our/.-ark-deploy/sidai-gen-utils
+ '[' -d /our/.-ark-deploy/sidai-gen-utils/bin ']'
+ /bin/mkdir -p /our/.-ark-deploy/sidai-gen-utils/bin
+ '[' -d /our/.-ark-deploy/sidai-gen-utils/man/man1 ']'
+ /bin/mkdir -p /our/.-ark-deploy/sidai-gen-utils/man/man1
+ '[' x = x ']'
+ '[' -d add-license ']'
+ /usr/bin/install -c add-license /our/.-ark-deploy/sidai-gen-utils/bin/add-license
+ /bin/chmod +x /our/.-ark-deploy/sidai-gen-utils/bin/add-license
+ '[' -d cpustat ']'
+ '[' -d diskstat ']'
+ '[' -d fill-symlink ']'
+ '[' -d find-junk-links ']'
+ '[' -d psduplex ']'
+ '[' -d psduplex.1 ']'
+ '[' -d pssimplex ']'
+ '[' -d pt ']'
+ '[' -d pt.1 ']'
+ '[' -d relink ']'
+ '[' -d rename ']'
+ '[' -d sanitize-exit-status ']'
+ '[' -d symlink-if-needed ']'
+ '[' -d symlinks-to ']'
+ '[' -d tcgrep ']'
+ '[' -d termtitle ']'
+ '[' -d trussdep ']'
+ '[' -d xon ']'

Oops - why did only the first one (add-license) call /usr/bin/install, the others did not.

The problem to be fixed is in 2 parts:

Problem #1:
===========
sidai local-scripts.xml package contains <code/> which is not compatible
across all platforms implementations of /bin/sh (either through a bug or a feature, I dont
know, but I'll explain:)

[from sidai/package/local-scripts.xml]

> for i in * ; do
>   if [ -d $i ] ; then
>      : we do not do dirs
>   else
>      case "$i" in
>        [A-Z]*) ;;         <<<<<<<<<<<<<<<<<<<<<< The culprit
>        *~)     ;;
>        *.1) $INSTALL -c $i $man1dir/$i
>      ;;
>        *)   $INSTALL -c $i $bindir/$i
>      /bin/chmod +x $bindir/$i
>      ;;
>      esac
>   fi
> done

I ran /bin/sh line-by-line on the 'ark package ..... --verbose' output and discovered
that the problem lay in the case pattern-matching on [A-Z]* - on a normal /bin/sh
i.e. a solaris one, this does not match on any of the files in sidai-gen-utils BUT on
a rh7.2 /bin/sh (which is sh v2.05 with ksh-like features) it DOES match, and it
seems to match on anything not starting with an 'a' in this particular case.

Caveats: I did not debug further so dont know if the syntax is non-portable, or if
the linux /bin/sh changes something in pattern matching, or whatever; I just tried
it on both platforms and got differing behaviour

More Caveats: I dont pretend to know what the above case [A-Z]* was trying
to achieve - can I delete it safely or what....?

NOTE: Linux provides a (undocumented?) /bin/bsh which seems to work just fine, hence
I looked to see where to change the default sh for invoking host.run() ... hence...

Problem #2:
===========
Hard-coded path to 'sh' in the ark run method, maybe needs to be this way for bootstrapping
but if new unices are bundling ksh-like stuff into /bin/sh maybe need a fallback to look
for /bin/bsh. You would think there are some things in life you can count on, but.....

> ARK/arkbase/ark/host.py: 327:
>             start_shell = start_shell + '/bin/sh'
>             if cmd == None:
>                 cmd = '/bin/sh'
>             else:
>                 args.append('/bin/sh')

Have fun....I'm not checking anything in to sidai so please advise....

Regards,

Gordon Allan