[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libtool-1.5.x quote.test fails with solaris /bin/ksh

From: Ralf Wildenhues
Subject: Re: libtool-1.5.x quote.test fails with solaris /bin/ksh
Date: Sat, 18 Dec 2004 21:20:39 +0100
User-agent: Mutt/1.5.6+20040907i

* Ralf Wildenhues wrote on Mon, Dec 13, 2004 at 09:14:07AM CET:
> * Alexander Kurz wrote on Thu, Dec 09, 2004 at 07:55:38PM CET:
> > while building libtool-1.5.x / CVS libtool 1.1773
> > make check fails on tests/quote.test on
> > mode { compile, link, install } and quoting { \\, \", \`, \$ }
> > The problem occured on two Sparc-Solaris machines
> > with different setup when solaris /bin/ksh was chosen
> > as interpreter for libtool.
> > Obviously libtool has quoting-problems with solaris ksh.
> > * the two testing-Platforms:
> > SunOS xxxxxxxx 5.6 Generic_105181-29 sun4u sparc SUNW,Ultra-5_10
> > strings /bin/ksh  | grep Ver # returns: @(#)Version M-11/16/88i
> > SunOS xxxxxxxx 5.7 Generic_106541-18 sun4u sparc SUNW,Ultra-4
> > strings /bin/ksh | grep Ver # returns @(#)Version M-11/16/88i
> Since output is bound to be huge, please mail to me rather than to the
> list, and also use gzip or preferably bzip2.  I can post a summary to
> the list afterwards.

Alrighty folks, after a lot of testing (many thanks to Alexander for his
patience with me), we've analyzed the behavior of above Korn shells:

Its internal escape mechanism for pattern bracket expressions in case
patterns is, to be just a tad euphemistic, "interesting".  That is,
  case $foo in
     *[\&]*)  echo yes;;
would print yes for both
unlike most other shells, which only print yes for the second line.
This behavior seems mostly independent of the symbol being escaped.

We can work around this by providing the bracket expression in a
variable, like this:
  case $foo in
    *$scanset*)  echo yes;;

Tested on some of shells[1], this seems to work mostly (feedback for
other shells greatly appreciated!).  Above SunOS Korn Shells still have
problems with the characters
  | ( ) & 

as seen in this example:
  case $foo in
    *$scanset*)  echo yes;;
would still print yes.

Don't you start to love internal shell quoting?

Now to how to solve this for libtool (where we want to see if any of a
set of special characters are present in a string):  move matching for
above characters out of the whole pattern, that is, instead of this

  case $foo in
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"") :;;

do this:

  scanset='[[~#^*{};<>?'"'"'    ]'
  case $foo in
    *$scanset* | *]* | *\|* | *\&* | *\(* | *\)*  | "") :;;

Of course, I could've also gone the cheap route and decide to let
libtool also put double-quotes around any argument containing any of
  \ ` " $
but that would have been much less fun, and makes look output more
awkward than necessary.  :-)

The patch attached fixes libtool branch-1-5 to work around the issue.
OK to apply?  (will forward-port)

BTW, I have a patch for updating Autoconf documentation in the works.


GNU bash, version 1.14.7(1)
GNU bash, version 2.05a.0(1)-release
GNU bash, version 2.05b.0(1)-release
GNU bash, version 3.00.14(1)-release
ash 0.2.92
dash 0.3.8
SunOS 5.6/5.7 ksh M-11/16/88i
FreeBSD 4.11-Prerelease / KSH93
PD KSH v5.2.14 99/07/13.2
ksh M-11/16/88f (AIX 5)
ksh M-12/28/93e (AIX 5)
SVR3 Bourne shell (AIX 5)

Attachment: ksh-case-branch-1-5.diff
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]