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

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...
  • Comment on Re^13: Net::OpenSSH loosing lines ins reply

Replies are listed 'Best First'.
Re^14: Net::OpenSSH loosing lines ins reply
by salva (Canon) on Jun 04, 2014 at 15:19 UTC
    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!!

        Don't call master_exited. Though that would probably not solve anything.

        What is print returning?

        for (@cmdout) { my $bytes = print $_; print STDERR "bytes: $bytes, err: $!\n"; }

        Also, use strace in order to see what is going on at the OS level.