| Bug #26416 | mysql-test-run exists with "Hangup" when piped to grep | ||
|---|---|---|---|
| Submitted: | 15 Feb 2007 17:30 | Modified: | 13 Mar 2007 2:06 |
| Reporter: | Christian Hammers (Silver Quality Contributor) (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Tests | Severity: | S3 (Non-critical) |
| Version: | 5.0.32, 4.1 BK, 5.1 BK | OS: | |
| Assigned to: | Magnus BlÄudd | CPU Architecture: | Any |
| Tags: | qc | ||
[16 Feb 2007 11:09]
Sveta Smirnova
Thank you for the report. All versions are affected: $cd ~/src/mysql-5.1/mysql-test $./mysql-test-run.pl --help 2>&1 | grep ssl ssl Use ssl protocol between client and server Hangup $cd ~/src/mysql-5.0/mysql-test $./mysql-test-run.pl --help 2>&1 | grep ssl ssl Use ssl protocol between client and server Hangup $cd ../../mysql-4.1/mysql-test/ $./mysql-test-run.pl --help 2>&1 | grep ssl ssl Use ssl protocol between client and server Hangup
[28 Feb 2007 9:54]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20742 ChangeSet@1.2622, 2007-02-28 10:52:51+01:00, msvensson@pilot.blaudden +1 -0 Bug#26416 mysql-test-run exits with "Hangup" when piped to grep - Thanks to Christian for the patch!
[8 Mar 2007 20:14]
Timothy Smith
pushed to 4.1.23, 5.0.38, 5.1.17
[13 Mar 2007 2:01]
Paul DuBois
No changelog entry needed.

Description: Hi Somebody did black magic with this perl script, it seems: # ./mysql-test-run --help 2>&1 | grep var Hangup The hangup is caused by this function in lib/mtr_process.pl: # FIXME for some reason, setting HUP to 'IGNORE' will cause exit() to # write out "Hangup", and maybe loose some output. We insert a sleep... sub mtr_exit ($) { my $code= shift; mtr_timer_stop_all($::glob_timers); local $SIG{HUP} = 'IGNORE'; ... kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp(); exit($code); } How to repeat: # ./mysql-test-run --help 2>&1 | grep var Hangup Suggested fix: --- old/mysql-test/lib/mtr_process.pl 2006-12-20 12:30:57.000000000 +0100 +++ new/mysql-test/lib/mtr_process.pl 2007-02-15 18:22:25.000000000 +0100 @@ -8,7 +8,7 @@ use Errno; use strict; -use POSIX 'WNOHANG'; +use POSIX qw(WNOHANG SIGHUP); sub mtr_run ($$$$$$;$); sub mtr_spawn ($$$$$$;$); @@ -1111,7 +1111,7 @@ # set ourselves as the group leader at startup (with # POSIX::setpgrp(0,0)), but then care must be needed to always do # proper child process cleanup. - kill('HUP', -$$) if !$::glob_win32_perl and $$ == getpgrp(); + POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp(); exit($code); } But don't ask me *why* exactly the Perl documentation seems to be wrong here when saying that POSIX::kill behaves exactly like the builtin kill, I've just tried it out and it worked!