RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 965182 - inconsistence between RHEL-6 and RHEL-7
Summary: inconsistence between RHEL-6 and RHEL-7
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: expect
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: beta
: ---
Assignee: Vitezslav Crhonek
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-20 16:09 UTC by Dalibor Pospíšil
Modified: 2013-07-24 10:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-23 15:37:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
strace output (RHEL7 expect, original script) (22.75 KB, text/plain)
2013-05-22 13:31 UTC, Vitezslav Crhonek
no flags Details
strace output (RHEL7 expect, modified script) (22.49 KB, text/plain)
2013-05-22 13:32 UTC, Vitezslav Crhonek
no flags Details
RHEL6 strace output (RHEL6 expect, original script) (22.26 KB, text/plain)
2013-05-22 13:33 UTC, Vitezslav Crhonek
no flags Details
RHEL6 strace output (RHEL7 expect, original script) (22.48 KB, text/plain)
2013-05-22 13:33 UTC, Vitezslav Crhonek
no flags Details
RHEL6 strace output (RHEL7 expect, modified script) (22.15 KB, text/plain)
2013-05-22 13:34 UTC, Vitezslav Crhonek
no flags Details

Description Dalibor Pospíšil 2013-05-20 16:09:17 UTC
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 13:30:06 UTC
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 13:31:25 UTC
Created attachment 751722 [details]
strace output (RHEL7 expect, original script)

Comment 4 Vitezslav Crhonek 2013-05-22 13:32:22 UTC
Created attachment 751723 [details]
strace output (RHEL7 expect, modified script)

Comment 5 Vitezslav Crhonek 2013-05-22 13:33:22 UTC
Created attachment 751724 [details]
RHEL6 strace output (RHEL6 expect, original script)

Comment 6 Vitezslav Crhonek 2013-05-22 13:33:52 UTC
Created attachment 751725 [details]
RHEL6 strace output (RHEL7 expect, original script)

Comment 7 Vitezslav Crhonek 2013-05-22 13:34:32 UTC
Created attachment 751726 [details]
RHEL6 strace output (RHEL7 expect, modified script)

Comment 9 Miroslav Vadkerti 2013-07-08 12:40:17 UTC
*** Bug 950070 has been marked as a duplicate of this bug. ***

Comment 10 Roman Rakus 2013-07-23 15:37:56 UTC
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.