This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

expect script hanging: ssh to localhost w/password authentication


Enclosed is an expect script (to ssh to the localhost with password
authentication) that "hangs" (search ahead for "parent: waiting for sync byte")
with the Dec 16 snapshot. Please take a look at the working and
non-working test cases below.

--
thanks,
Tom

working case (20051029 cygwin1.dll snapshot):

  ~ $ uname -a
  CYGWIN_NT-5.0 OurServer108 1.5.19s(0.141/4/2) 20051029 16:39:28 i686 unknown unknown Cygwin
  ~ $ cat /tmp/fee
  #!/usr/bin/expect
  #exp_internal 1  
    #to turn on debugging

  set env(TERM) "vt100"

  set USER staffuser1
  set PASSWORD "PASSWORDTEXTHERE"

  set prompt " $USER >"
    # adjust prompt as required

  spawn ssh localhost -l $USER

  expect "assword:"
  send "$PASSWORD\r"

  expect $prompt
  # --------------------------------------------------------------------
  # launch command with the next send below:
  #   exit the shell after running command
  # --------------------------------------------------------------------

  send "date; exit\r"

  expect; # waits for eof, so output is flushed?
  puts "\n\nexpect script exiting normally\n";
  ~ $ /tmp/fee
  spawn ssh localhost -l staffuser1
  staffuser1@localhost's password:
  Last login: Mon Dec 19 07:52:33 2005 from 127.0.0.1
  Welcome to Engineering Systems tcm server ..
  > 07:56:44 Mon Dec 19 0j tty3 5136 ~
  > OurServer108 staffuser1 > date; exit
  Mon Dec 19 07:56:44 CST 2005
  logout
  Connection to localhost closed.


  expect script exiting normally

  ~ $

--
failing case (20051216 cygwin1.dll snapshot):

  ~ $ uname -a
  CYGWIN_NT-5.0 OurServer108 1.5.19s(0.148/4/2) 20051216 23:59:19 i686 unknown unknown Cygwin
  ~ $ cat /tmp/fee
  #!/usr/bin/expect
  exp_internal 1
    #to turn on debugging

  set env(TERM) "vt100"

  set USER staffuser1
  set PASSWORD "PASSWORDTEXTHERE"

  set prompt " $USER >"
    # adjust prompt as required

  spawn ssh localhost -l $USER

  expect "assword:"
  send "$PASSWORD\r"

  expect $prompt
  # --------------------------------------------------------------------
  # launch command with the next send below:
  #   exit the shell after running command
  # --------------------------------------------------------------------

  send "date; exit\r"

  expect; # waits for eof, so output is flushed?
  puts "\n\nexpect script exiting normally\n";
  ~ $ /tmp/fee
  spawn ssh localhost -l staffuser1
  parent: waiting for sync byte
  Killed
  ~ $  # after a long wait, I manually killed "expect" from another bash session


--
Tom Rodman

--

Attachment: cygcheck.out
Description: cygcheck -s -v -r

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]