From abee382683d1b977f2ab4a91121b4277045e6d5a Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 17 Mar 2009 19:33:08 -0600 Subject: [PATCH] Manual: mention more expr pitfalls. * doc/autoconf.texi (Limitations of Usual Tools) : Mention HP-UX limitation, and $ ambiguity. * THANKS: Update. Reported by Jens Schmidt, in http://bugs.debian.org/466990. Signed-off-by: Eric Blake --- ChangeLog | 8 ++++++++ THANKS | 1 + doc/autoconf.texi | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index 259004ef..3829924f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-03-18 Eric Blake + + Manual: mention more expr pitfalls. + * doc/autoconf.texi (Limitations of Usual Tools) : + Mention HP-UX limitation, and $ ambiguity. + * THANKS: Update. + Reported by Jens Schmidt, in http://bugs.debian.org/466990. + 2009-03-17 Jim Meyering Manual: fix a typo. diff --git a/THANKS b/THANKS index c3e19a20..8d8bb37a 100644 --- a/THANKS +++ b/THANKS @@ -164,6 +164,7 @@ Jeffrey A Law law@cygnus.com Jeffrey J. Barteet ? Jennis Pruett ? Jens Petersen petersen@redhat.com +Jens Schmidt jens.schmidt35@arcor.de Jeremy Yallop jeremy@yallop.org Jerker Bäck jerker.back@home.se Jim Blandy jimb@wookumz.gnu.ai.mit.edu diff --git a/doc/autoconf.texi b/doc/autoconf.texi index a0a19b8b..a4cb0d15 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -16642,6 +16642,21 @@ Portable @command{expr} regular expressions should not begin with @samp{^}. Patterns are automatically anchored so leading @samp{^} is not needed anyway. +On the other hand, the behavior of the @samp{$} anchor is not portable +on multi-line strings. Posix is ambiguous whether the anchor applies to +each line, as was done in older versions of @acronym{GNU} Coreutils, or +whether it applies only to the end of the overall string, as in +Coreutils 6.0 and most other implementations. + +@example +$ @kbd{baz='foo} +> @kbd{bar'} +$ @kbd{expr "X$baz" : 'X\(foo\)$'} + +$ @kbd{expr-5.97 "X$baz" : 'X\(foo\)$'} +foo +@end example + The Posix standard is ambiguous as to whether @samp{expr 'a' : '\(b\)'} outputs @samp{0} or the empty string. In practice, it outputs the empty string on most platforms, but portable @@ -16718,6 +16733,14 @@ $ @kbd{expr 00001 : '.*\(...\)'} 1 @end example +On @acronym{HP-UX} 11, @command{expr} only supports a single +sub-expression. + +@example +$ @kbd{expr 'Xfoo' : 'X\(f\(oo\)*\)$'} +expr: More than one '\(' was used. +@end example + @item @command{fgrep} @c ------------------