Bug 1003097 - expr match behaviour changed in Fedora 19.
expr match behaviour changed in Fedora 19.
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2013-12-13 09:56:06 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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.

PWD=$(pwd)
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:

Always.

Steps to Reproduce:
1.
2.
3.

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:
http://sourceware.org/ml/libc-alpha/2012-12/msg00456.html
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=6410c7a6
http://lists.gnu.org/archive/html/bug-grep/2011-12/msg00003.html

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