Bug 27437

Summary: pm-suspend hangs on grep in remove_parameters() (pm-utils=1.2.6.1)
Product: pm-utils Reporter: Joel Hough <joel>
Component: GeneralAssignee: Richard Hughes <richard>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: major    
Priority: medium CC: joel
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Proposed patch to fix pm-suspend

Description Joel Hough 2010-04-03 02:54:24 UTC
Created attachment 34641 [details]
Proposed patch to fix pm-suspend

pm-suspend hangs with the process "grep -vxFf /var/run/pm-utils/pm-suspend/ storage/parameters.rm /var/run/pm-utils/pm-suspend/storage/parameters" taking 100% CPU

An update in grep 2.6.2 broke the -Ff option for pattern files with blank lines causing an infinite loop, and the behavior of -Ff in grep 2.6.3 will match all lines if the pattern file contains a blank line. See http://lists.gnu.org/archive/html/bug-grep/2010-04/msg00037.html

/var/run/pm-utils/pm-suspend/storage/parameters.rm is generated with a leading blank line in pm-utils/functions remove_parameters with a 
echo '' > "$PARAMETERS.rm"
command.

From looking at the source, pm-utils=1.3.0 will also be affected.

See also: http://bugs.archlinux.org/task/18881

Steps to reproduce:
1) Run pm-suspend with grep>=2.6.2 (may only affect multibyte locales per bugfix news at http://savannah.gnu.org/forum/forum.php?forum_id=6274)

Attached is a proposed patch.

For the record, I'm running Arch Linux on an MSI Wind U100.
Comment 1 Joel Hough 2010-04-06 10:53:48 UTC
grep 2.6.3 does not hang and works as expected.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.