ARGHH!!!! Problem NOT solved, but worked around....
I added a sleep 10 in one of the tests, because I could NOT get a system
q{strace...} to work, so I wrote the PID to a file, and then added the sleep
so I could start the strace by hand. Well, guess what? If you sleep for a
few seconds inbetween:
$expect->spawn();
$expect->expect();
Then the damn tests work fine. This is a perfect example of why anytime
someone says "just use expect" I am not very receptive to the idea. This
code is fragile, and VERY hard to work with.
Ugh..... Two hours tracking this bitch down.....
On Mon, Jun 7, 2010 at 11:27 PM, Phillip Moore <[email protected]>wrote:
>
> I really hate Expect.... It is NOT behaving predictably. I added
> straces to the first 2 uses, and then just had the 3rd and 4th tests
> suddently work.... and then they both fail again the next time!! I *am*
> getting predictable results for the first pair, but I can't explain them.
>
> The one that succeeds shows:
>
> sendto(4, "<30>Jun 7 23:21:39 efsclient[13461]: Calling read_password\n",
> 60, MSG_NOSIGNAL, NULL, 0) = 60
> close(4) = 0
> stat("/dev/tty", {st_mode=S_IFCHR|0666, st_rdev=makedev(5, 0), ...}) = 0
> open("/dev/tty", O_RDWR) = 4
> ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
> fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(5, 0), ...}) = 0
> fcntl(4, F_SETFD, FD_CLOEXEC) = 0
> open("/dev/tty", O_WRONLY|O_CREAT|O_APPEND, 0666) = 5
> lseek(5, 0, SEEK_END) = -1 ESPIPE (Illegal seek)
> ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> lseek(5, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
> fstat(5, {st_mode=S_IFCHR|0666, st_rdev=makedev(5, 0), ...}) = 0
> fcntl(5, F_SETFD, FD_CLOEXEC) = 0
> write(5, "Password for efstest: ", 22) = 22
> ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost -isig -icanon -echo
> ...}) = 0
> read(4, "efstest\n", 99) = 8
> write(5, "\n", 1) = 1
> ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon echo
> ...}) = 0
> close(4) = 0
> close(5) = 0
>
> The one that fails shows:
>
> sendto(4, "<30>Jun 7 23:21:43 efsclient[13478]: Calling read_password\n",
> 60, MSG_NOSIGNAL, NULL, 0) = 60
> close(4) = 0
> stat("/dev/tty", {st_mode=S_IFCHR|0666, st_rdev=makedev(5, 0), ...}) = 0
> open("/dev/tty", O_RDWR) = 4
> ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
> fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(5, 0), ...}) = 0
> fcntl(4, F_SETFD, FD_CLOEXEC) = 0
> open("/dev/tty", O_WRONLY|O_CREAT|O_APPEND, 0666) = 5
> lseek(5, 0, SEEK_END) = -1 ESPIPE (Illegal seek)
> ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> lseek(5, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
> fstat(5, {st_mode=S_IFCHR|0666, st_rdev=makedev(5, 0), ...}) = 0
> fcntl(5, F_SETFD, FD_CLOEXEC) = 0
> write(5, "Password for efstest: ", 22) = 22
> ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost -isig -icanon -echo
> ...}) = 0
> read(4, "", 99) = 0
> --- SIGHUP (Hangup) @ 0 (0) ---
>
> Both uses of expect are nearly IDENTICAL code, as far as talking to the
> process is concerned.
>
>
>
> On Mon, Jun 7, 2010 at 11:09 PM, Phillip Moore
> <[email protected]>wrote:
>
>> The 15_security/20_cli.y test has been broken for quite sometime, and I
>> finally got around to fixing it, since I NEED to test the CLI logic, after
>> totally reworking the code. I addresses the obvious issue (we always
>> skipped the last 4 tests), and now I've got a VERY strange problem that has
>> me stumped (been awhile...)
>>
>> There are four tests that use expect, and they are almost identical. The
>> first one works fine, the second fails, and after tossing syslog calls into
>> the code, I have tracked the problem to here: in EFS/CLI.pm, in
>> query_password, I have:
>>
>> EFS::Syslog->message( q{info}, q{Calling read_password} );
>> my $authpass = q{};
>> eval { $authpass = read_password($args{prompt}) };
>> EFS::Syslog->message( q{info}, q{Eval is done} );
>> my $eval_error = $EVAL_ERROR;
>> if ( $eval_error ) {
>> EFS::Syslog->message( q{err}, q{Failed to read password:
>> $eval_error} );
>> }
>> elsif ( not $authpass ) {
>> EFS::Syslog->message( q{info}, q{Null password} );
>> }
>> else {
>> EFS::Syslog->message( q{info}, q{Successfully read password} );
>> }
>>
>> The "Eval is done" message NEVER shows up, and the process is dying at
>> that point. I am about to resort to stracing the process, but under what
>> situation does eval NOT trap an exception?
>>
>> Suggestions?
>>
>
>
_______________________________________________
EFS-dev mailing list
[email protected]
http://mailman.openefs.org/mailman/listinfo/efs-dev