Hi,

I am trying to solve this bug in Net::SFTP::Foreign.

The problem happens when Expect is used to spawn the slave SSH process so that interprocess communication goes through a PTY. After some investigation I have found that the operative system drops data when syswrite is called with more than 512 bytes or when consecutive enough syswrites summing up more than 512 bytes are performed.

Is there any way to work around this "feature"? as for instance, some way to configure the PTY to not drop data or to increment its buffer size?

Or, is there any way in Expect to get rid of the PTY once the interactive phase is over, using a regular pipe for the rest of the IPC?

It seems that HP-UX and AIX are affected by this problem, Linux is not.

update: a testing script:

$| = 1; use Net::SFTP::Foreign; # $Net::SFTP::Foreign::debug=1|2|4|32|64; while (1) { my $s = Net::SFTP::Foreign->new('localhost', password => '...'); my $r = $s->put($ARGV[0], "/tmp/delete.me"); print "ok: $r\n"; }
to test, install Net::SFTP::Foreign and Expect, set the correct password inside the script and run it passing as argument the path to a file of 100KB aprox.

In reply to Expect and PTY dropping data by salva

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.