Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 56705
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.17.1
Fixed in: 2.18.1



Subject: Failed test 'Connect with invalid option fails' at t/01connect.t line 79.
Test `Connect with invalid option fails' fails: $ make test PGINITDB="/usr/bin/initdb" PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00-signature.t .... skipped: Set the environment variable TEST_SIGNATURE to enable this test t/00_release.t ...... skipped: Test skipped unless environment variable RELEASE_TESTING is set t/00basic.t ......... ok t/01connect.t ....... Please wait, creating new database for testing t/01connect.t ....... 4/13 # Failed test 'Connect with invalid option fails' # at t/01connect.t line 79. # '' # doesn't match '(?-xism:DBI connect.+failed:)' # # DBI Version 1.609 # DBD::Pg Version 2.17.1 # Perl Version 5.10.0 # OS linux # PostgreSQL (compiled) 80403 # PostgreSQL (target) 80403 # PostgreSQL (reported) PostgreSQL 8.4.3 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.4.3 20100127 (Red Hat 4.4.3-4), 64-bit # Default port 5432 # DBI_DSN dbi:Pg:db="postgres";port=5440;host=<pwd>/dbdpg_test_database/data/socket # DBI_USER petr # Test schema dbd_pg_testschema # LANG C # array_nulls on # backslash_quote safe_encoding # client_encoding UTF8 # server_encoding UTF8 # standard_conforming_strings off # Adjusted: initdb # Looks like you failed 1 test of 13. t/01connect.t ....... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/13 subtests t/01constants.t ..... ok t/02attribs.t ....... ok t/03dbmethod.t ...... ok t/03smethod.t ....... ok t/04misc.t .......... ok t/06bytea.t ......... ok t/07copy.t .......... ok t/08async.t ......... ok t/09arrays.t ........ ok t/12placeholders.t .. ok t/20savepoints.t .... ok t/99_perlcritic.t ... skipped: Test skipped unless environment variable RELEASE_TESTING is set t/99_pod.t .......... skipped: Test skipped unless environment variable RELEASE_TESTING is set t/99_spellcheck.t ... skipped: Test skipped unless environment variable RELEASE_TESTING is set t/99_yaml.t ......... skipped: Test skipped unless environment variable RELEASE_TESTING is set t/99cleanup.t ....... 1/1 Removing test database directory t/99cleanup.t ....... ok Test Summary Report ------------------- t/01connect.t (Wstat: 256 Tests: 13 Failed: 1) Failed test: 9 Non-zero exit status: 1 Files=20, Tests=1707, 33 wallclock secs ( 0.32 usr 0.06 sys + 5.51 cusr 7.64 csys = 13.53 CPU) Result: FAIL Failed 1/20 test programs. 1/1707 subtests failed. make: *** [test_dynamic] Error 255 As you can see I do not use preconfigured database, no DBI_* variables are defined. This bug presents in DBD-Pg 2.17.1 and SVN r13899.
From: ppisar [...] redhat.com
Dne Po 19.dub.2010 04:16:06, ppisar napsal(a): Show quoted text
> Test `Connect with invalid option fails' fails: > > $ make test > PGINITDB="/usr/bin/initdb" PERL_DL_NONLAZY=1 /usr/bin/perl > "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', > 'blib/arch')" t/*.t > t/00-signature.t .... skipped: Set the environment variable > TEST_SIGNATURE to enable this test > t/00_release.t ...... skipped: Test skipped unless environment variable > RELEASE_TESTING is set > t/00basic.t ......... ok > t/01connect.t ....... Please wait, creating new database for testing > t/01connect.t ....... 4/13 > # Failed test 'Connect with invalid option fails' > # at t/01connect.t line 79. > # '' > # doesn't match '(?-xism:DBI connect.+failed:)' > # > # DBI Version 1.609 > # DBD::Pg Version 2.17.1 > # Perl Version 5.10.0 > # OS linux > # PostgreSQL (compiled) 80403 > # PostgreSQL (target) 80403 > # PostgreSQL (reported) PostgreSQL 8.4.3 on > x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.4.3 20100127 (Red > Hat 4.4.3-4), 64-bit > # Default port 5432 > # DBI_DSN > dbi:Pg:db="postgres";port=5440;host=<pwd>/dbdpg_test_database/data/socket > # DBI_USER petr > # Test schema dbd_pg_testschema > # LANG C > # array_nulls on > # backslash_quote safe_encoding > # client_encoding UTF8 > # server_encoding UTF8 > # standard_conforming_strings off > # Adjusted: initdb > # Looks like you failed 1 test of 13. > t/01connect.t ....... Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/13 subtests >
Despite the LANG variable report, the test runs in non-C locale (cs_CZ.UTF-8 respectively). $ LANG=C make test makes all test to pass. Thus my conlusion is the test suite is locale sensitive and does not work outside C locale.
Having problems reproducing this - anyone have ideas? Changing LANG and recompiling the target Postgres cluster with a different locale has no effect.
Subject: Re: [rt.cpan.org #56705] Failed test 'Connect with invalid option fails' at t/01connect.t line 79.
Date: Tue, 29 Mar 2011 13:50:29 +0200
To: Greg Sabino Mullane via RT <bug-DBD-Pg [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
I dug more into it and I found the reason. The connect_database() does in t/dbdpg_test_setup.pl: goto GOTDBH if eval { $dbh = DBI->connect($testdsn, $testuser, $ENV{DBI_PASS}, {RaiseError => 1, PrintError => 0, AutoCommit => 1}); 1; }; warn qq{DBI->connect returned: <$@>\n}; if ($@ =~ /invalid connection option/) { return $helpconnect, $@, undef; } (I put the warn message for debugging purposes.) This is what I get in `C' locale: $ LANG=C perl -Ilib -I../blib/arch -I../blib/lib/ ./01connect.t 1..15 ok 1 - Established a connection to the database ok 2 - Disconnect from the database ok 3 - Second database connection attempt worked ok 4 - Connected with second database handle ok 5 - Disconnect with first database handle ok 6 - Disconnect with second database handle ok 7 - Disconnect again with second database handle ok 8 - Execute fails on a disconnected statement DBI->connect returned: <DBI connect('dbbarf=postgres;port=5440;host=/home/petr/fedora/perl-DBD-Pg/DBD-Pg-2.17.2/t/dbdpg_test_database/data/socket','petr',...) failed: invalid connection option "dbbarf" at dbdpg_test_setup.pl line 91 Show quoted text
>
ok 9 - Connect with invalid option fails [...] And this what I get in `cs_CZ.UTF-8' locale: $ LANG=cs_CZ.UTF-8 perl -Ilib -I../blib/arch -I../blib/lib/ ./01connect.t 1..15 ok 1 - Established a connection to the database ok 2 - Disconnect from the database ok 3 - Second database connection attempt worked ok 4 - Connected with second database handle ok 5 - Disconnect with first database handle ok 6 - Disconnect with second database handle ok 7 - Disconnect again with second database handle ok 8 - Execute fails on a disconnected statement DBI->connect returned: <DBI connect('dbbarf=postgres;port=5440;host=/home/petr/fedora/perl-DBD-Pg/DBD-Pg-2.17.2/t/dbdpg_test_database/data/socket','petr',...) failed: neplatný parametr spojení "dbbarf" at dbdpg_test_setup.pl line 91 Show quoted text
>
not ok 9 - Connect with invalid option fails # Failed test 'Connect with invalid option fails' # at ./01connect.t line 79. # '' # doesn't match '(?-xism:DBI connect.+failed:)' [...] The $@ you parse is error message from PostgreSQL client library. And PostgreSQL provides Czech translation: neplatný parametr spojení "%s" of C message: invalid connection option "%s" So, to reproduce this bug, you need to install Czech message catalogue for Postgre library (/usr/share/locale/cs/LC_MESSAGES/libpq5-8.4.mo) what you don't have apparently. To fix DBD::Pg package tests, you need to set locale (LC_ALL environment variable) to the same language you expect later in your tests before invoking PostgreSQL library functions. -- Petr
Thanks, I am able to duplicate it now. For others, the secret was to compile Postgres with --enable-nls, set the LANG to Czech, and then do a perl Makefile.PL; make against the libraries and run the test.
Made a somewhat hacky patch in r14808 that should fix it.