Bug 1003097 - expr match behaviour changed in Fedora 19.
Summary: expr match behaviour changed in Fedora 19.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-30 18:55 UTC by Ben Greear
Modified: 2013-12-13 14:56 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-13 14:56:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ben Greear 2013-08-30 18:55:36 UTC
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 12:32:17 UTC
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 Petr Stodulka 2013-12-13 14:21:32 UTC
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 14:56:06 UTC
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.