Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Problem with IO::Pty and sshing with Net::Telnet and pseudo-terminals

by c0bra (Acolyte)
on Mar 13, 2008 at 16:51 UTC ( [id://674009]=perlquestion: print w/replies, xml ) Need Help??

c0bra has asked for the wisdom of the Perl Monks concerning the following question:

For a while now we've had code running on a bunch of Solaris machines that makes ssh connections by using IO::Pty to create pesudoterminals and having Net::Telnet read/write from them, as described in the examples section here: Net::Telnet

The problem I'm running into now is that we've had to move to new machines and it's decided to stop working. Right now it's complaining "No such file or directory found" on this line:

open STDIN, "<&$tty_fd" or die $!;

And since it hangs on trying to get the terminal prompt I assume it can make the ssh connection but simply cannot read anything back. I have no clue as to why something like this would happen. It's the same versions of perl, IO::Pty, IO::Tty, and Net::Telnet from one working install to the broken one. Google hasn't come up with anything either. Has anyone run into something like this? Thanks in advance!

Replies are listed 'Best First'.
Re: Problem with IO::Pty and sshing with Net::Telnet and pseudo-terminals
by samtregar (Abbot) on Mar 13, 2008 at 17:01 UTC
    It's the same versions of Perl and the relevant modules, but is it the same version of Solaris and the same C compiler? My distant memory of Solaris is that things can go bad fast if you change compilers, particularly if you compile Perl with one compiler and use a different one for your modules.

    Also, do the modules pass their own tests?

    -sam

      Yea they're both Solaris 10. Same version of gcc on both but as I did not handle the installs (and don't have rights to do so) I can't be 100% sure what they used. I'll try to find out if the admins ever get back to me. Perl looks like it was compiled with cc, though cc doesn't seem to exist on the machine.

      I also can't check the module tests for the same reason, I guess.

        You should be able to download the modules and build and test them in a directory you own. The only thing you need root for is to install them system wide.

        I bet you're going to have problems though - if Perl was compiled with Sun's cc and you don't have Sun's cc to compile modules with then you're in trouble. Most likely you need to either get cc installed or compile a new Perl with gcc.

        -sam

Re: Problem with IO::Pty and sshing with Net::Telnet and pseudo-terminals
by mr_mischief (Monsignor) on Mar 13, 2008 at 17:01 UTC
    Did you only move the code to a new machine, or did you also make some change to the machine to which the code connects? Since you're matching a particular prompt and blocking on that, if the prompt no longer matches you'll block forever or timeout.

    I'm curious why you're using Net::Telnet with a command-line ssh rather than using Net::SSH, but if it's been working then there's probably a way to fix it so that it works again.

Re: Problem with IO::Pty and sshing with Net::Telnet and pseudo-terminals
by c0bra (Acolyte) on Mar 13, 2008 at 18:17 UTC
    I found the problem. Looks like an old version of the code made it onto all the machines. Just bad timing.

    This is the code that was breaking:

    open STDIN, '<', "&$tty_fd" or die $!;

    I had fixed it but apparently not in that old version. Sorry for leading you all on a wild goose chase :(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://674009]
Approved by sweetblood
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found