autoconf-patches
[Top][All Lists]
Advanced

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

doc: more Limitations of Builtins: case, read


From: Ralf Wildenhues
Subject: doc: more Limitations of Builtins: case, read
Date: Wed, 22 Dec 2004 14:10:39 +0100
User-agent: Mutt/1.4.1i

After a bugreport by Alexander Kurz against libtool-1-5 failing
quote.test[1], we found out that SunOS 5.6/5.7 ksh fails to handle
backslash-escaping in case character classes in interesting ways
(see patch below).  This shell which will be selected as CONFIG_SHELL
if Libtool is used.

We found a workaround that uses variable expansion.  I tested a bunch
of shells and could not find any more restrictions other than the ones
mentioned below.  Further feedback for more shells is much appreciated.

Since I hope our workaround is actually sufficient, I took the liberty
of proposing a documentation update.  It also mentions that some Bourne
shells have problems with closing brackets in character classes, and
the existence of shells whose `read' does not understand `-r'.

Regards,
Ralf

[1] http://lists.gnu.org/archive/html/bug-libtool/2004-12/msg00096.html
and following thread.


2004-12-22  Ralf Wildenhues <address@hidden>

        * doc/autoconf.texi (Limitations of Builtins) <case>: Mention 
        problems with SunOS ksh and backslash escaping, Bourne shells and
        closing brackets (both within character classes).  Bug reported
        against Libtool by Alexander Kurz <address@hidden>.
        <read>: New entry.  Mention non-availability of -r.


Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.851
diff -u -r1.851 autoconf.texi
--- doc/autoconf.texi   14 Dec 2004 01:04:25 -0000      1.851
+++ doc/autoconf.texi   22 Dec 2004 11:00:32 -0000
@@ -10607,6 +10607,25 @@
 OK
 @end example
 
+Many Bourne shells cannot handle closing brackets in character classes
+correctly either.
+
+Some shells also have problems with backslash escaping in case you do not want
+to match the backslash:  Both a backslash and the escaped character match this
+pattern.  To work around this, specify the character class in a variable, so
+that quote removal does not apply afterwards, and the special characters don't
+have to be backslash-escaped:
+
address@hidden
+$ @kbd{case '\' in [\<]) echo OK;; esac}
+OK
+$ @kbd{scanset='[<]'; case '\' in $scanset) echo OK;; esac}
+$
address@hidden example
+
+Even with this, SunOS 5.7 ksh matches a backslash if the set contains any
+of the characters @samp{|}, @samp{&}, @samp{(}, or @samp{)}.
+
 Some shells, such as Ash 0.3.8, are confused by an empty
 @code{case}/@code{esac}:
 
@@ -10842,6 +10861,12 @@
 @end example
 
 
address@hidden @command{read}
address@hidden ------------------
address@hidden @command{read}
+Not all shells support @option{-r} (Solaris 9 @command{/bin/sh} for example).
+
+
 @item @command{pwd}
 @c ----------------
 @prindex @command{pwd}




reply via email to

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