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

Will Partain <[email protected]> Tue, 19 Feb 2002 20:28:33 +0000
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
Gordon A wrote, some time back:

> 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

Yes.  /bin/sh on RedHat 7.2 is 2.x; on 6.2, it was 1.14.x.
If you consult the COMPAT file in current bash, you will see
that the culprit you point out falls afoul of locale
gubbins; i.e. it will do what you don't expect unless locale
== C.

I haven't thought all the way through this one, but a patch
(untested) that should make the thing behave as intended is:

diff -ru1 ark/sidai/package/local-scripts.xml ark-tmp/sidai/package/local-scripts.xml
--- ark/sidai/package/local-scripts.xml	Sat Oct  6 11:57:26 2001
+++ ark-tmp/sidai/package/local-scripts.xml	Tue Feb 19 16:07:45 2002
@@ -64,2 +64,5 @@
 
+# see bash 2.x COMPAT document for why this:
+LC_COLLATE=C; export LC_COLLATE # make [A-Z] work as expected
+
 [ -d $bindir  ] || $MKDIR_P $bindir
@@ -73,3 +76,3 @@
 	    case "$i" in
-	      [A-Z]*) ;;
+	      [A-Z]*) ;; # dodgy, see LOCALE thing above
 	      *~)     ;;

> 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.....

I'm going to keep counting on /bin/sh for now, and write a
bit more paranoid-ly, I guess.

Will