Bug 976504 - pxssh.py wrong timeout
pxssh.py wrong timeout
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pexpect (Show other bugs)
6.3
All Linux
unspecified Severity low
: rc
: ---
Assigned To: Marek Grac
BaseOS QE - Apps
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-20 13:15 EDT by Benjamin
Modified: 2015-08-19 03:52 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-19 03:52:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Benjamin 2013-06-20 13:15:44 EDT
Description of problem:
cannot use pxssh.py which is part of pexpect, always running into timeout:



Version-Release number of selected component (if applicable):
pexpect-2.3-6.el6.noarch

How reproducible:
echo <<EOF > ssh.py
import pxssh
s = pxssh.pxssh()
if not s.login ('localhost', 'myuser', 'mypass'):
    print "SSH session failed on login."
    print str(s)
else:
    print "SSH session login successful"
    s.sendline ('ls -l')
    s.prompt()         # match the prompt
    print s.before     # print everything before the prompt.
    s.logout()
EOF

Steps to Reproduce:
1. python ssh.py
2. see error msg

Actual results:
Traceback (most recent call last):
  File "ssh.py", line 3, in <module>
    if not s.login ('localhost', 'myuser', 'mypassword'):
  File "/usr/lib/python2.6/site-packages/pxssh.py", line 243, in login
    if not self.synch_original_prompt():
  File "/usr/lib/python2.6/site-packages/pxssh.py", line 134, in synch_original_prompt
    self.read_nonblocking(size=10000,timeout=1) # GAS: Clear out the cache before getting the prompt
  File "/usr/lib/python2.6/site-packages/pexpect.py", line 815, in read_nonblocking
    r,w,e = self.__select([self.child_fd], [], [], timeout)
  File "/usr/lib/python2.6/site-packages/pexpect.py", line 1549, in __select
    return select.select (iwtd, owtd, ewtd, timeout)


Expected results:
Output of ssh command "ls -l"

Additional info:
Fix:
132a133,134
>         self.sendline()
>         time.sleep(0.5)

add this before line 134, and it works as expected.
This should also affect rhel5 pexpect package, but not verified.
Comment 2 Marek Grac 2013-06-24 05:30:22 EDT
@Benjamin:

Thanks for bugreport. According to my research it is enough to just add 

self.sendline()

can you confirm it too? I would prefer not to add additional delays if it is not necessary.
Comment 6 Marek Grac 2014-04-30 10:05:41 EDT
@Alan: 

pexpect-u ->
it requires python3 which will be in rhel7 only partially and fence-agents were not tested with it at all

package renaming -> it was obtained from fedora and no-one complained, otherwise it will be fixed; this way we have to wait for rhel8

Note You need to log in before you can comment on or make changes to this bug.