Bug 10733 - grep -P looks broken wrt pipes
Summary: grep -P looks broken wrt pipes
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: grep (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-30 00:12 MSK by at@altlinux.org
Modified: 2010-09-20 21:46 MSD (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description at@altlinux.org 2007-01-30 00:12:20 MSK
$ rpm -qa --qf '[%{PROVIDES}\n]' |grep -Po '^lib[^/()]+[.]so\b[^/()]*'
outputs lines that match the soname pattern as well as lines that do not match
the pattern; and even empty lines which are not in the input.

http://lists.altlinux.org/pipermail/devel/2007-January/041110.html
Comment 1 Dmitry V. Levin 2007-04-15 00:54:47 MSD
grep -P is also utterly broken, besides of -o option:

$ for i in `seq 1 999`; do rpm -qa --qf '[%{PROVIDES}\n]' |grep -P
'^lib[^/()]+\.so' |grep -vc ^lib; done |sort |uniq -c |sort -n
      3 2
     62 3
    934 1

Thats is, looks like grep -P returns semi-random wrong results.
Comment 2 Dmitry V. Levin 2007-09-19 05:09:57 MSD
Something odd happens with pipes: replacing
rpmquery -a --qf '[%{PROVIDES}\n]'
with
cat file
makes grep -Po happy.
Comment 3 Dmitry V. Levin 2010-09-20 21:46:52 MSD
In grep-2.6.3-alt1 the bug is already fixed.