Hi,
I'm installing DBD::Oracle 1.20 and I'm getting the following error
from 't/10general.t'.
not ok 1 - system exit 1 should return 256
# Failed test (t/10general.t at line 45)
# got: '-1'
# expected: '256'
not ok 2 - system exit 0 should return 0
# Failed test (t/10general.t at line 46)
# got: '-1'
# expected: '0'
It it generated from this code in 't/10general.t':
# basic check that we can fork subprocesses and wait for the status
# after having connected to Oracle
is system("exit 1;"), 1<<8, 'system exit 1 should return 256';
is system("exit 0;"), 0, 'system exit 0 should return 0';
If reran with this piece of code added to 't/10general.t' after the
connection to the database:
for (1,0) {
$rc = system("exit $_;");
print "\$rc [$rc]\n";
print "\$! [$!]\n";
}
and got this:
$rc [-1]
$! [No child processes]
$rc [-1]
$! [No child processes]
I think something harvest the child that 'system' spawned before
'system' could reap it.
This same problem was reported to dbi-users mailing list:
http://www.nntp.perl.org/group/perl.dbi.users/2006/11/msg30463.html
http://www.nntp.perl.org/group/perl.dbi.users/2007/06/msg31533.html
My environment is:
(1) Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit
Production
(2) SunOS xxxxxxx 5.10 Generic_127111-03 sun4u sparc SUNW,Sun-Fire-V890
(3) perl 5.8.7
(4) DBI 1.604
This is also puzzling.
It works when I ran a script pointing to the 'blib'.
Here is the script:
#!/usr/local/perl/bin/perl -w
use lib '/tmp/at2191/tmp_perl/lib/perl5/site_perl'; # tmp lib
containing DBI 1.604
use blib '/tmp/at2191/install/dbd_orc/DBD-Oracle-1.20/blib'; # use blib
containing DBD 1.20
use DBI qw(:sql_types :utils);
print "$_\n" for @INC;
$ORACLE_SID = 'uclde';
$ORACLE_HOME = '/usr/local/opt/oracle/product/10.2.0';
$ENV{'ORACLE_HOME'} = $ORACLE_HOME;
$dbh = DBI->connect( "dbi:Oracle:$ORACLE_SID",
'ndpprod',
'prod',
{ RaiseError => 0,
PrintError => 1,
AutoCommit => 0
}
) ||
die "Database connection not made: $DBI::errstr";
print "Database Name is $dbh->{Name}\n";
for (1, 0) {
$rc = system("exit $_;");
print "\$rc [$rc]\n";
print "\$! [$!]\n";
}
END {
$dbh->disconnect if $dbh;
print "end of script\n";
}
The output from the script is:
/tmp/at2191/install/dbd_orc/DBD-Oracle-1.20/blib/arch
/tmp/at2191/install/dbd_orc/DBD-Oracle-1.20/blib/lib
/tmp/at2191/tmp_perl/lib/perl5/site_perl
/appl_dsl/mod_perl/lib/perl5/site_perl
/usr/local/cm58/lib/perl5/5.8.7/sun4-solaris-64
/usr/local/cm58/lib/perl5/5.8.7
/usr/local/cm58/lib/perl5/site_perl/5.8.7/sun4-solaris-64
/usr/local/cm58/lib/perl5/site_perl/5.8.7
/usr/local/cm58/lib/perl5/site_perl
.
Database Name is uclde
$rc [256]
$! []
$rc [0]
$! []
end of script
I was wondering if anyone knows the cause of why the test in
't/10general.t' failed.
thank you
Albert Tom
San Ramon, Ca.