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

Re: regex matching bug in expr



Jim Meyering <jim@meyering.net> writes:

> Did you build that yourself?  On what sort of system?

No, it's latest Debian unstable for powerpc.

> Maybe the problem is that it was built to use a buggy version
> of a regexp function.  There are some configure-time tests that try
> to decide whether to use the included lib/regex.c or the version
> in your C library.

> It works fine for me using Debian's expr-2.0i and the expr-2.0.11
> that I built myself on a pretty old redhat system.

Hmm, 2.0.11?  Arg, it seems that powerpc build daemon is lagging
behind again.  How depressing.

apt-show-source says:

shellutils           = 2.0i-1          | shellutils            = 2.0.11-1

There were quite some issues when we went from libc2.1 -> 2.2, quite
possibly the powerpc shellutils binary is still from the 2.1 era.

> Would you please try the latest version?

Yes, I'll try and recompile myself, I'll be back in an hour or so.

> Jan Nieuwenhuizen <janneke@gnu.org> wrote:
> | What's the exact definition for expr's regular expressions?  There
> | seems to be a bug, see below.  Its behaviour is not what I expect, and
> | different from grep and sed.
> |
> | Greetings,
> | Jan.
> |
> | from expr info pages:
> |
> | `STRING : REGEX'
> |      Perform pattern matching.  The arguments are coerced to strings
> |      and the second is considered to be a (basic, a la GNU `grep')
> |      regular expression, with a `^' implicitly prepended.  The first
> |      argument is then matched against this regular expression.
> |
> |
> | 12:54:28 appel ~$ expr 'whats/wrong/here' : '\([a-z/]*/\).*'
> |
> | 12:54:32 appel ~$ expr 'whats/wrong/here' : '\([a-z]*/\).*'
> | whats/
> | 12:54:38 appel ~$ echo 'whats/wrong/here' | sed -e s'%^\([a-z/]*/\).*%\1%'
> | whats/wrong/
> | 12:54:48 appel ~$ echo 'whats/wrong/here' | grep '^\([a-z/]*/\).*'
> | whats/wrong/here
> |
> | 12:56:18 appel ~$ expr --version
> | expr (GNU sh-utils) 2.0i
> | Written by Mike Parker.
> 

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org



Reply to: