Bug 965182 - inconsistence between RHEL-6 and RHEL-7
inconsistence between RHEL-6 and RHEL-7
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: expect (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity high
: beta
: ---
Assigned To: Vitezslav Crhonek
BaseOS QE - Apps
: TestBlocker
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-20 12:09 EDT by Dalibor Pospíšil
Modified: 2013-07-24 06:52 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-23 11:37:56 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)
strace output (RHEL7 expect, original script) (22.75 KB, text/plain)
2013-05-22 09:31 EDT, Vitezslav Crhonek
no flags Details
strace output (RHEL7 expect, modified script) (22.49 KB, text/plain)
2013-05-22 09:32 EDT, Vitezslav Crhonek
no flags Details
RHEL6 strace output (RHEL6 expect, original script) (22.26 KB, text/plain)
2013-05-22 09:33 EDT, Vitezslav Crhonek
no flags Details
RHEL6 strace output (RHEL7 expect, original script) (22.48 KB, text/plain)
2013-05-22 09:33 EDT, Vitezslav Crhonek
no flags Details
RHEL6 strace output (RHEL7 expect, modified script) (22.15 KB, text/plain)
2013-05-22 09:34 EDT, Vitezslav Crhonek
no flags Details

  None (edit)
Description Dalibor Pospíšil 2013-05-20 12:09:17 EDT
Description of problem:
expect behavior on RHEL-7 is unexpected comparing to RHEL-6

Version-Release number of selected component (if applicable):
expect-5.45-8.el7

How reproducible:
always

Steps to Reproduce:
see below
mind the second expect


Actual results:
[root@rhel7 tmp]# expect << EOF
> spawn -noecho sudo su -
> expect "#" {send "echo a\r"}
> expect "#" {send "exit\r"}
> EOF
[root@rhel7 ~]# echo a
a
[root@rhel7 ~]# [root@rhel7 tmp]# 
[root@rhel7 tmp]# expect << EOF
> spawn -noecho bash
> send "sudo su -\r"
> expect "#" {send "echo a\r"}
> expect "#" {send "exit\rexit\r"}
> EOF
sudo su -
[root@rhel7 tmp]# sudo su -
[root@rhel7 ~]# [root@rhel7 tmp]# 

Expected results:
[root@rhel6 ~]# expect << EOF
> spawn -noecho sudo su -
> expect "#" {send "echo a\r"}
> expect "#" {send "exit\r"}
> EOF
[root@rhel6 ~]# echo a
a
[root@rhel6 ~]# [root@rhel6 ~]# 
[root@rhel6 ~]# expect << EOF
> spawn -noecho bash
> send "sudo su -\r"
> expect "#" {send "echo a\r"}
> expect "#" {send "exit\rexit\r"}
> EOF
sudo su -
[root@rhel6 ~]# sudo su -
echo a
[root@rhel6 ~]# echo a
a
[root@rhel6 ~]# [root@rhel6 ~]# 


Additional info:
Comment 2 Vitezslav Crhonek 2013-05-22 09:30:06 EDT
In my opinion this is not fault of expect.

Dalibor tested RHEL6 expect version (expect-5.44.1.15-4) built for RHEL7 in RHEL7 and it behaved same like RHEL7 expect version (expect-5.45-8) - wrong. I tested RHEL7 expect version build for RHEL6 in RHEL6 and it worked fine, so something else must be different...

We have also found workaround, the second script works when it's modified like this:

spawn -noecho bash
send "sudo su -\r"
expect "#" {send "echo a\r"}
sleep 1
expect "#" {send "exit\rexit\r"}

('sleep 0.2' should suffice)
Comment 3 Vitezslav Crhonek 2013-05-22 09:31:25 EDT
Created attachment 751722 [details]
strace output (RHEL7 expect, original script)
Comment 4 Vitezslav Crhonek 2013-05-22 09:32:22 EDT
Created attachment 751723 [details]
strace output (RHEL7 expect, modified script)
Comment 5 Vitezslav Crhonek 2013-05-22 09:33:22 EDT
Created attachment 751724 [details]
RHEL6 strace output (RHEL6 expect, original script)
Comment 6 Vitezslav Crhonek 2013-05-22 09:33:52 EDT
Created attachment 751725 [details]
RHEL6 strace output (RHEL7 expect, original script)
Comment 7 Vitezslav Crhonek 2013-05-22 09:34:32 EDT
Created attachment 751726 [details]
RHEL6 strace output (RHEL7 expect, modified script)
Comment 9 Miroslav Vadkerti 2013-07-08 08:40:17 EDT
*** Bug 950070 has been marked as a duplicate of this bug. ***
Comment 10 Roman Rakus 2013-07-23 11:37:56 EDT
You are not waiting to bash initialization. You have to do:
expect '#' {send "sudo su -\r"}
instead of:
send "sudo su -\r"

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