FS#18881 - [grep] version 2.6.2 hangs when issuing a pm-suspend

Attached to Project: Arch Linux
Opened by Tomas M. (eldragon) - Tuesday, 30 March 2010, 12:34 GMT
Last edited by Allan McRae (Allan) - Saturday, 03 April 2010, 07:54 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Allan McRae (Allan)
Architecture i686
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

Description:
when issuing a pm-suspend, grep 2.6.2 in testing hangs, cpu usage at 100% . killing it continues the suspend process.

the command being run is
grep -vxFf /var/run/pm-utils/pm-suspend/ storage/parameters.rm /var/run/pm-utils/pm-suspend/storage/parameters

taken from the system monitor

grep 2.6.1 works ok.

This task depends upon

Closed by  Allan McRae (Allan)
Saturday, 03 April 2010, 07:54 GMT
Reason for closing:  Fixed
Additional comments about closing:  grep-2.6.3 in [testing]
Comment by Allan McRae (Allan) - Tuesday, 30 March 2010, 12:42 GMT
What happens if you run that command manually? Note there is an extra space in the file name above.
Comment by Peter Wegas (ccc1) - Tuesday, 30 March 2010, 22:20 GMT
seems to be a bug in grep.
"grep -vxFf foo bar" should write all lines of bar to stdout, which do not occur in foo.
if the first line of foo is empty, the new version of grep hangs. the old version didn't show this behavior.
that's the reason why pm-suspend fails ....
Comment by Peter Wegas (ccc1) - Tuesday, 30 March 2010, 22:50 GMT
infact this bug occurs in a more general setting:
"grep -Ff foo bar" will hang if foo contains an empty line.
Comment by Tomas M. (eldragon) - Wednesday, 31 March 2010, 00:08 GMT
should i file this upstream? where? im not familiar with grep development..
Comment by Allan McRae (Allan) - Wednesday, 31 March 2010, 00:15 GMT
I have sent a message to the bug-grep mailing list
Comment by Raphael Kimmig (raf kimmig) - Wednesday, 31 March 2010, 09:46 GMT
I just sent an email with the following info to the list, just for reference:
---------------------
I can trigger it with LANG='de_DE.utf8' but it doesn't happen with LC_ALL=C.

The blocking occurs in kwsearch.c (relevant commit: 6d952beebdac1d8f31ba20abb12a756a9877e50d ), if I revert that specific patch the blocking is gone but now the output is incorrect, so this doesn't seem to seems to be source of the error.

$ src/grep -Ff <(printf '\na') <(printf 'a\nb')
a

$ LC_ALL=C src/grep -Ff <(printf '\na') <(printf 'a\nb')
a
b
---------------------

Regards,

Raphael Kimmig
Comment by Raphael Kimmig (raf kimmig) - Wednesday, 31 March 2010, 10:01 GMT
Seems I was a bit slow :-) Already fixed:

Paolo Bonzini wrote:
> I just posted a patch to fix this and add it to the testsuite.
>
>
> Paolo



Comment by Allan McRae (Allan) - Wednesday, 31 March 2010, 10:05 GMT
Yes - I have started updating the package. Will upload when I get home.
Comment by Joel Hough (JoelHough) - Friday, 02 April 2010, 21:48 GMT
A workaround to get pm-suspend working until a fixed grep is available which involves editing /usr/lib/pm-utils/functions to leave out the leading blank line has worked for me and may be helpful to others:
@@ -219,9 +219,9 @@
remove_parameters() {
local p
if [ "$1" = "all" ]; then
- echo '' > "$PARAMETERS.new"
+ :>"$PARAMETERS.new"
else
- echo '' > "$PARAMETERS.rm"
+ :>"$PARAMETERS.rm"
for p in "$@"; do
echo "$p" >> "$PARAMETERS.rm"
done
Comment by Peter Wegas (ccc1) - Saturday, 03 April 2010, 01:52 GMT
the new version of grep from testing and grep-2.5.4 still behave strangly, if the search pattern file contains an empty line.
grep -Ff foo bar will then just match every line of bar.
i guess that's not intended.
Comment by Allan McRae (Allan) - Saturday, 03 April 2010, 02:48 GMT
That is supposed to be fixed by http://git.savannah.gnu.org/cgit/grep.git/commit/?id=5fa8c7c9 . I have sent a query upstream.
Comment by Vitor Sakaguti (vitoreiji) - Saturday, 03 April 2010, 07:35 GMT
I can confirm that Joel Hough's patch works. Thanks!
Comment by Allan McRae (Allan) - Saturday, 03 April 2010, 07:53 GMT
> grep -Ff foo bar will then just match every line of bar.

Confirmed upstream that this is intended. pm-utils needs fix. File a separate bug report for that.

Loading...