Grep corrupt in BusyBox 1.15.2

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Thu Dec 3 18:35:16 UTC 2009


On Thu, 3 Dec 2009, Göran Hillebrink wrote:

> If I run the command:
>
> echo "/var/test" | grep -o '[^/]*$'
>
> I should get the result test but grep ends up in a forever loop.

Right.
I see the same thing with BusyBox v1.16.0.git.

Funny though.  I was not aware grep did 'sed' job too (edit the result).
I see GNU grep 2.5.1, 2.5.3 and 2.5.4 do the same thing.  Man page says:

,----
| DESCRIPTION
| 	grep searches the named input FILEs (or standard input if no
| 	files are named, or the file name - is given) for lines containing
| 	a match to the given PATTERN.  By default, grep prints the
| 				       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| 	matching lines.
| 	^^^^^^^^^^^^^^
`----

and:

,----
| 	-o, --only-matching
| 	    Show only the part of a matching line that matches PATTERN.
`----

seems to contradict that.  Weird...  Bug?


Cheers,

-- 
Cristian


More information about the busybox mailing list