forked from perl5-dbi/DBD-MariaDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workaround for broken MariaDB clients which overwrite SIGPIPE h…
…andler MariaDB Connector/C 3.0.0 in function mysql_server_init() for non-Windows systems started setting SIGPIPE handler to SIG_IGN. This breaks Perl applications which installed its own SIGPIPE signal handler. As a workaround use Perl rsignal_save() function to save existing SIGPIPE handler before calling mysql_server_init() and after that restore saved handler via Perl rsignal_restore() function. Add a test which verifies that DBI->connect() which calls DBD::MariaDB's mariadb_dr_connect() function and which calls mysql_server_init(), does not overwrite $SIG{PIPE} handler set in Perl code. Fixes: perl5-dbi#170 See: http://jira.mariadb.org/browse/CONC-591
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use DBI; | ||
|
||
use vars qw($test_dsn $test_user $test_password); | ||
use lib 't', '.'; | ||
require 'lib.pl'; | ||
|
||
plan skip_all => '$SIG{PIPE} is not supported' unless exists $SIG{PIPE}; | ||
|
||
plan tests => 1; | ||
|
||
my $sigpipe_handler_called; | ||
$SIG{PIPE} = sub { $sigpipe_handler_called = 1; }; | ||
|
||
DBI->connect($test_dsn, $test_user, $test_password, { RaiseError => 0, PrintError => 0, AutoCommit => 0 }); | ||
|
||
kill('PIPE', $$); | ||
|
||
ok($sigpipe_handler_called, 'DBI->connect() does not overwrite $SIG{PIPE} handler'); |