grep -o causes infinite loop

Bug #619817 reported by Jonas Bonn on 2010-08-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
busybox (Ubuntu)

Bug Description

Binary package hint: initramfs-tools

Bringing up initramfs busybox shell and executing following command causes an infinite loop:

cat /proc/meminfo | grep MemTotal | grep -o "[0-9]*"

This is, of course, a problem if the same command is issued in a script. The culprit is the "-o" option on the last grep...

Related branches

Jonas Bonn (jonas.bonn) wrote : Maverick, last checked August 18.

Colin Watson (cjwatson) on 2010-08-19
affects: initramfs-tools (Ubuntu) → busybox (Ubuntu)
Changed in busybox (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Colin Watson (cjwatson) wrote :

Reproducible with current upstream from git.

Colin Watson (cjwatson) wrote :

I believe that this happens if and only if the pattern matches the empty string.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package busybox - 1:1.15.3-1ubuntu2

busybox (1:1.15.3-1ubuntu2) maverick; urgency=low

  * armel seems to build fine without -marm nowadays, so remove it.
  * grep-o-loop.patch: Fix infinite loop in 'grep -o' with a pattern that
    matches the zero-length string at the start of the line (LP: #619817).
 -- Colin Watson <email address hidden> Thu, 19 Aug 2010 15:16:46 +0100

Changed in busybox (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers