Bug 950070

Summary: expect login shows different behavior as in RHEL6
Product: Red Hat Enterprise Linux 7 Reporter: Miroslav Vadkerti <mvadkert>
Component: expectAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED WONTFIX QA Contact: Miroslav Vadkerti <mvadkert>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: ksrot, mvadkert, ovasik, vcrhonek
Target Milestone: rcKeywords: Regression, Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-15 07:26:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 950090    

Description Miroslav Vadkerti 2013-04-09 14:55:51 UTC
Description of problem:
I have this simple script
# cat test.exp
#!/usr/bin/expect -d
set timeout 60
spawn login
expect -nocase {login} {send "eal\r"}
expect -nocase {password} {send "fo0m4nchU\r"}
expect -nocase {level} {send "\r"}
send "PS1=:\\::\r"
expect {:::$} {send "exit\r"}
expect {:::$} {close; wait}'

On RHEL6 it works well:
-----------------------
# ./test.exp
expect version 5.44.1.15
argv[0] = /usr/bin/expect  argv[1] = -d  argv[2] = ./test.exp  
set argc 0
set argv0 "./test.exp"
set argv ""
executing commands from command file ./test.exp
spawn login
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {21762}

expect: does "" (spawn_id exp4) match glob pattern "login"? no
login: 
expect: does "login: " (spawn_id exp4) match glob pattern "login"? yes
expect: set expect_out(0,string) "login"
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "login"
send: sending "eal\r" to { exp4 }
[snip]

On RHEL7 it fails:
------------------
# ./test.exp 
expect version 5.45
argv[0] = /usr/bin/expect  argv[1] = -d  argv[2] = ./test.exp  
set argc 0
set argv0 "./test.exp"
set argv ""
executing commands from command file ./test.exp
spawn login
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {18543}

expect: does "" (spawn_id exp4) match glob pattern "login"? no
expect: read eof
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) ""
expect: spawn id exp4 not open
    while executing
"expect -nocase {password} {send "fo0m4nchU\r"}"
    (file "./test.exp" line 5)

Version-Release number of selected component (if applicable):
util-linux-2.23-0.3.el7.x86_64
expect-5.45-8.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. execute test.exp script
  
Actual results:
On RHEL7 the expect reads eof. In strace I see:
select(5, [4], [], [4], {59, 999888})   = 1 (in [4], left {59, 997051})
gettimeofday({1365518725, 918093}, NULL) = 0
read(4, 0x127cb98, 4096)                = -1 EIO (Input/output error)
write(2, "expect: read eof\r\n", 18expect: read eof^M
[snip]

Expected results:
Script works as on RHEL6

Additional info:
The workaround I'm using now is to use sleep 1 after the spawn

Comment 2 Vitezslav Crhonek 2013-05-27 08:37:48 UTC
I tested it on RHEL6 with RHEL7 version of expect and it worked fine, RHEL6 version on RHEL7 doesn't work fine - similar to https://bugzilla.redhat.com/show_bug.cgi?id=965182.

Comment 4 Miroslav Vadkerti 2013-06-05 14:13:00 UTC
Reopenning. Sorry still I ocassionally see the issue

Comment 5 Miroslav Vadkerti 2013-07-08 12:40:17 UTC
This seems to be a dupe of Bug 965182.

*** This bug has been marked as a duplicate of bug 965182 ***

Comment 6 Miroslav Vadkerti 2013-07-23 15:45:47 UTC
Reopenning, this is not the same issue as dapospis reported.

Comment 7 Miroslav Vadkerti 2013-10-01 10:43:03 UTC
Still seeing the same behaviour with:

# rpm -q expect util-linux
expect-5.45-8.el7.x86_64
util-linux-2.23.2-5.el7.x86_64

Odd thing is that downgrading the expect to EL6 versions doesn't make the issue go away ... I will try to downgrade also TCL

Comment 8 Miroslav Vadkerti 2013-11-12 12:59:17 UTC
Can I provide any other information here? I do not like the idea having unnecessary sleeps in our tests. Thanks

Comment 9 Vitezslav Crhonek 2013-11-12 13:57:25 UTC
Well, you can try to identify which component causes this change somehow. I was not able too find out.

TCL is for sure one candidate, did the downgrade of it make any change?

Comment 10 Karel Srot 2014-02-28 06:46:31 UTC
Miro,
could you please check whether this is still an issue on recent composes? Thank you.

Comment 11 Miroslav Vadkerti 2014-02-28 07:55:15 UTC
Yep this is still an issue [1]. I will finally try out to downgrade the TCL to a RHEL6 version ...

[1] # ./test.exp 
spawn login
expect: spawn id exp4 not open
    while executing
"expect -nocase {password} {send "fo0m4nchU\r"}"
    (file "./test.exp" line 5)

Comment 12 Miroslav Vadkerti 2014-02-28 08:39:00 UTC
I still see the issue when downgrading to tcl-8.5.7-6 which should be the latest RHEL6 version. So looks like this must be an issue somewhere else as downgrading tcl or expect did not help ...

Comment 13 Vitezslav Crhonek 2014-03-24 15:48:07 UTC
Moving to 7.1.0 - we don't know which component is causing the issue, but there's a workaround.

Comment 20 RHEL Program Management 2020-12-15 07:26:26 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.