|
From: Jean-Laurent H. <hu...@ho...> - 2001-11-08 01:13:03
|
Hi There,
I'm using Expect to see if a program causes a segfault under certain
circumstances. The code I'm using looks like that:
$exp->expect(undef,
... several expect match clauses ...
[ eof => sub {
my $self = shift;
$eof = 1;
} ],
);
my $status = $exp->soft_close();
return ($exp->exitstatus() == 11);
That works fine under HPUX 10.20. Unfortunately on HPUX 11.00,
$exp->exitstatus() is not defined. I looked at Expect.pm and found that on
some condition (2:EOF) the exitstatus value does not get set. If I apply the
following diffs to Expect.pm, my code works on HPUX 11.00 as well:
759c759,760
< $exp->hard_close();
---
> my $hard_close_status = $exp->hard_close();
> ${*$exp}{exp_Exit} = $hard_close_status unless ${*$exp}{exp_Exit};
Can you consider including this fix (or a similar one) to the next version
of Expect? I can test your fix if you send me a beta version.
Thanks,
Jean-Laurent
Here is some debugging info:
-----------------------------------------------------------------
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x402a9e4c)', undef, 'ARRAY(0x402a7b24)',
'ARRAY(0x402a7ce0)', 'ARRAY(0x402a9ef4)', 'ARRAY(0x402a9fa8)') called at
test.pl line 191
main::run_passwd(...) called at test.pl line 316
main::test_107() called at test.pl line 382
main::main() called at test.pl line 390
Closing spawn id(4).
Expect::hard_close('Expect=GLOB(0x402a9e4c)') called at
/usr/local/lib/perl5/site_perl/5.005/Expect.pm line 759
Expect::_multi_expect(undef, undef, 'ARRAY(0x402af9d0)') called at
/usr/local/lib/perl5/site_perl/5.005/Expect.pm line 478
Expect::expect('Expect=GLOB(0x402a9e4c)', undef, 'ARRAY(0x402a7b24)',
'ARRAY(0x402a7ce0)', 'ARRAY(0x402a9ef4)', 'ARRAY(0x402a9fa8)') called at
test.pl line 191
main::run_passwd(...) called at test.pl line 316
main::test_107() called at test.pl line 382
main::main() called at test.pl line 390
spawn id(4) closed.
Pid 17741 of spawn id(4) exited, Status: 11
Closing spawn id(4).
Expect::soft_close('Expect=GLOB(0x402a9e4c)') called at test.pl line 193
main::run_passwd(...) called at test.pl line 316
main::test_107() called at test.pl line 382
main::main() called at test.pl line 390
Closing spawn id(4).
Expect::hard_close('Expect=GLOB(0x402a9e4c)') called at
/usr/local/lib/perl5/site_perl/5.005/Expect.pm line 1485
Expect::DESTROY('Expect=GLOB(0x402a9e4c)') called at test.pl line 324
eval {...} called at test.pl line 324
main::test_107() called at test.pl line 382
main::main() called at test.pl line 390
Pid 17741 of spawn id(4) exited, Status: -1
-----------------------------------------------------------------
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1
uname='hp-ux disco b.11.00 u 9000800 125901587 unlimited-user license '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O', gccversion=2.9-hppa-991112
cppflags='-D_HPUX_SOURCE -I/usr/local/include -D_FILE_OFFSET_BITS=64
-I/usr/local/include'
ccflags ='-D_HPUX_SOURCE -I/usr/local/include -D_FILE_OFFSET_BITS=64
-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lnsl -lndbm -ldld -lm -lpthread
libc=/usr/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-B,deferred '
cccdlflags='-fpic', lddlflags='-b -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under hpux
Compiled at Jun 12 2001 12:31:36
@INC:
/usr/local/lib/perl5/5.00503/PA-RISC1.1
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/PA-RISC1.1
/usr/local/lib/perl5/site_perl/5.005
.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|