Bug 1003097 - expr match behaviour changed in Fedora 19.
expr match behaviour changed in Fedora 19.
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-08-30 14:55 EDT by Ben Greear
Modified: 2013-12-13 09:56 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-12-13 09:56:06 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ben Greear 2013-08-30 14:55:36 EDT
Description of problem:

On Fedora 17 and earlier, this would set userdir equal to something
like /home/greearb/ when pwd was /home/greearb/git

On Fedora 19, userdir is empty.

userdir=$(expr match "$PWD" '\(/home/[0-Z]*/\).*')

Work-around seems to be:

[[ $PWD =~ (/home/[0-Z]*/).* ]] && userdir=${BASH_REMATCH[1]}

Not sure if this is a bug in expr or my bash script, but since
it used to work and now doesn't, it might be a regression.

Version-Release number of selected component (if applicable):

coreutils 8.21-11

How reproducible:


Steps to Reproduce:

Actual results:

Expected results:

Additional info:
Comment 1 Ondrej Vasik 2013-09-03 08:32:17 EDT
Thanks for report, I'm able to reproduce it with coreutils-8.21, not able with coreutils-8.17 and older (so "only" F19+ systems affected). As the expr code didn't change meanwhile, I assume gnulib regexp module has some related changes. I'll try to investigate it more, unfortunately even the "debug" mode in expr was not really helpful so far.
Comment 2 pstodulk 2013-12-13 09:21:32 EST
In Fedora 17 and earlier was parsing of regexp case-insensitive, so you couldn't match only what you want.
You need:
userdir=$(expr match "$PWD" '\(/home/[0-9a-zA-Z]*/\).*')

This behaviour is expected (discussed with upstream). It's not bug.
Comment 3 Pádraig Brady 2013-12-13 09:56:06 EST
Yes [0-Z] is a very unusual range that would not have worked in C locales anyway for example.

The behavior here is implementation defined according to POSIX.
There has been movement lately to implement "Rational Ranges" in GNU tools.

Some links:

Note You need to log in before you can comment on or make changes to this bug.