Bug 1463542

Summary: script doesn't wait for command completion when running non-interactive
Product: Red Hat Enterprise Linux 7 Reporter: Leos Pol <lpol>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: bblaskov, lpol
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1463545 (view as bug list) Environment:
Last Closed: 2017-06-23 07:38:44 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: 1463545, 1463550    

Description Leos Pol 2017-06-21 08:29:21 UTC
Description of problem:
Script prematurely exits before command when running in non-interactive shell. See steps and additional sections for more info.

Version-Release number of selected component (if applicable):
util-linux-2.23.2-43.el7

How reproducible:
always

Steps to Reproduce:
1. # script -c 'sleep 1;echo run' < /dev/null && echo finished

Actual results:
Script started, file is typescript
Script done, file is typescript
finished
# run   < this is output from script's command
# 

Expected results:
Script started, file is typescript
run
Script done, file is typescript
finished

Additional info:
Actually "exits" is not the right term here. Script command is running but its parent become PID=1. That's the reason why chained command is executed before script finishes. Also it could block using bash scripts with util-linux's script in for example jenkins, ansible, and so on.

Comment 2 Karel Zak 2017-06-21 09:48:51 UTC
This issue is fixed since v2.27 by script(1) rewrite.

I have doubts we can fix RHEL version without the command rebase. Is it really so critical issue to rebase script(1) for RHEL7.5 ?

The script(1) is originally designed to run interactive session on terminal, use /dev/null as STDIN is not supported for the old versions at all.

Comment 3 Leos Pol 2017-06-23 07:38:44 UTC
I can't evaluate how critical this issue is for customers, but my usecase is be able to run my bash tool with /usr/bin/script in ansible shell task. Due to this issue my tool has different behavior in interactive terminal vs. ansible.

Anyhow I don't think rebase is justified without customer case and I need to run my script on RHEL >= 5, CentOS >= 6, and Fedora, so I've to workaround this anyway.

Closing as WONTFIX.

Thanks.