in reply to Re^11: Net::OpenSSH loosing lines ins reply
in thread Net::OpenSSH loosing lines ins reply

update: /tmp/ssh_del_$$.txt is COMPLETE

Ah, from your post Re^2: Net::OpenSSH loosing lines ins reply, I understood "/tmp/ssh_del_$$.txt" was also missing some lines even if the file size was the same!

if STDOUT were completely empty, I would suspect of Sys::SigAction doing something funny to STDOUT, but you say that the line numbers are there... I can not imagine how that could happen. Is like if $_ were changing from one call to the next?

You can try reducing the script, first removing Net::OpenSSH from it. You already have the output on the /tmp/ssh_del_$$.txt files, so you don't need to retrieve them again.

Replies are listed 'Best First'.
Re^13: Net::OpenSSH loosing lines ins reply
by Andy16 (Acolyte) on Jun 04, 2014 at 15:12 UTC
    Hi Salva,
    I still did not manage to explain the situation:
    /tmp/ssh_del_$$.txt is complete (no line numbers)
    two.out is complete (incl line numbers)
    STDOUT misses a block of lines (see above)

    STDOUT is missing the lines in total - numbers and content.

    I'll continue to cut down the script to the needed fragments for reproducing it...

    not yet giving up...
      STDOUT is missing the lines in total - numbers and content.
      Then, the problem is very likely to be Sig::SigAction breaking some builtin at an inconvenient time and corrupting perl internal state.

      Anyway, running the program with strace may also give some hint.

        Hi,

        stripped it down to that level:
        #!perl -w use strict; use warnings; use Data::Dumper; use Net::OpenSSH; my $sshuser="user"; my $sshpwd="pwd"; my $device = $ARGV[0]; my $sshcmd = $ARGV[1]; my $error; my $ssh; my $path = "./Y.ssh"; $ssh = Net::OpenSSH->new( $device, user => $sshuser, passwd => $sshpwd, ctl_dir => $path, master_opts => [-o => "StrictHostKeyChecking=no", -o => "UserKnown +HostsFile=/dev/null"], strict_mode => 0, master_stderr_discard => 1 # to get rid of login screen ); my @cmdout; my @cmdout2; @cmdout2 = $ssh->capture({stdin_data => "\n"}, $sshcmd."\n"); open FILE, "<", "./rawout.txt"; @cmdout = <FILE>; close(FILE); $ssh->master_exited; foreach (@cmdout) { print $_; } exit 0;



        YES - program is for testing ONLY
        no sense !!

        BUT
        output misses some lines from time to time!!

        Output is FINE if I don't run the capture

        back to you - I'm out of ideas now, at least for today

        Thanks for help!!