GNU bug report logs - #5812
expr: Difference in behavior of match and :

Previous Next

Package: coreutils;

Reported by: Adil Mujeeb <mujeeb.adil <at> gmail.com>

Date: Wed, 31 Mar 2010 14:05:01 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 5812 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Adil Mujeeb <mujeeb.adil <at> gmail.com>
Cc: 5812 <at> debbugs.gnu.org
Subject: Re: bug#5812: expr: Difference in behavior of match and :
Date: Wed, 31 Mar 2010 15:48:56 -0600
[Message part 1 (text/plain, inline)]
On 03/31/2010 07:05 AM, Adil Mujeeb wrote:
> Hello team,
> 
> I have tried following snippet in a bash script:
> 
> -bash-3.1$userid=`expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" :
> ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"`
> -bash-3.1$echo $userid
> ADILM
> -bash-3.1$

I cannot repeat your results with 7.6 (the version in fedora 12) or the
latest coreutils.git.

$ expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" : \
   ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"

$ expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" : \
   ".*uid=[0-9]*(\(.[0-9a-zA-Z]*\)) .*"
ADILM

Perhaps you have a locale issue at play?

> -bash-3.1$ rpm -qf /usr/bin/expr
> coreutils-5.97-12.1.el5

That's rather old.  Perhaps it might be a bug that has been fixed in the
meantime, in which case, you would want to upgrade to 8.4.

At any rate, there's nothing in the source code that introduces any case
insensitivity, and the documentation is correct, that match and : behave
identically.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 15 years and 111 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.