grep -o causes infinite loop

Bug #619817 reported by Jonas Bonn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
busybox (Ubuntu)
Fix Released
Medium
Unassigned

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

Revision history for this message
Jonas Bonn (jonas.bonn) wrote :

...in Maverick, last checked August 18.

Colin Watson (cjwatson)
affects: initramfs-tools (Ubuntu) → busybox (Ubuntu)
Changed in busybox (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

Reproducible with current upstream from git.

Revision history for this message
Colin Watson (cjwatson) wrote :

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

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.