[Date Prev] [Date Index] [Date Next] [Thread Prev] [Thread Index] [Thread Next]

Problems exec consoles using expect scripts

Tore Anderson tore@fud.no
Wed, 4 Dec 2013 20:32:35 GMT


When using consoles that are exec-ing expect scripts, I get troubles
like line buffering of input and local echo. I have the following
console definitions:

console test-ssh {
	master localhost;
	type exec;
	exec "ssh server";
console test-expect {
	master localhost;
	type exec;
	exec "expect-console";

Where the script "expect-console" contains only the following:

#!/usr/bin/expect --
spawn ssh server

The conserver user's ssh key is installed on "server", so both consoles
connect fine and I get a shell on "server". However, on the
"test-expect" console input is being line buffered and I get local echo.
So if I e.g. run mc, arrow up/down key presses to navigate the menus
doesn't get registered until I press the enter key, at which point
everything happens as once. (However, the arrow up/down keypresses gets
echoed back to the console immediately as ^[OA / ^[OB and similar
garbage.) Same with using e.g. "less", in order to go to the next page,
I have to press space+enter, and q+enter to quit. If I do "su", the
password I enter gets echoed back to me.

I am pretty sure this is not ssh's fault, as I can replace the ssh
command with an "ipmitool sol activate" command and get the exact same

However, if I run the "expect-console" script directly from the shell on
the server running conserver, it works perfectly. It's only when the
script is invoked from within conserver that the problems occur.

Have anyone experienced this issue and/or have any suggestions on how to
fix it? If so that would be greatly appreciated!

I'm running Ubuntu 12.04 x86_64 with the distribution packages of both
conserver (version 8.1.18) and expect (version 5.45), for what it's worth.

Best regards,
Tore Anderson