Bug 1384499

Summary: scl wrapper does not replace self with command
Product: Red Hat Software Collections Reporter: Aleksandar Kostadinov <akostadi>
Component: scl-utilsAssignee: Joe Orton <jorton>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: jorton, kanderso
Target Milestone: ---   
Target Release: 3.6   
Hardware: Unspecified   
OS: Unspecified   
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:47:06 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:

Description Aleksandar Kostadinov 2016-10-13 12:17:39 UTC
Description of problem:
doing `scl enable rh-ruby23 some command` does not replace scl wrapper process with the command but executes command as a sub-process.

This is creating an unnecessary process nesting and is problematic in some scenarios.

One example is running inside a container. the `scl` becomes PID1 but it cannot adopt and clean dead children processes.
Another example is in scirpting, one may expect to do something like:
scl ... &
pid = $!
kill -9 $pid

But this would not kill actual process, only the SCL wrapper process.

I believe `scl` should run processes in way similar as much as possible to running same processes without scl. IMO this is the point of SCL.

Version-Release number of selected component (if applicable):
RHEL7

How reproducible:
always

Steps to Reproduce:
1. scl enable rh-ruby23 -- sleep 1000 &
2. ps -ef

Actual results:

> default       1      0  0 12:06 ?        00:00:00 /usr/bin/scl enable rh-ror42 -- /usr/local/bin/run-jnlp-client ...
> default       6      1  0 12:06 ?        00:00:00 /bin/bash /var/tmp/sclPDpKGu
> default      21      6  5 12:06 ?        00:00:06 java -cp /home/jenkins/remoting.jar hudson.remoting.jnlp.Main ...

Expected results:

> default      1      0  5 12:06 ?        00:00:06 java -cp /home/jenkins/remoting.jar hudson.remoting.jnlp.Main ...

Additional info:
Basically I would expect that scl and helper script to be replaced by the actual process user cares about. Not sure about exact change needed in the `scl` binary but the content of helper script /var/tmp/sclPDpKGu is this:

> eval "SCLS=( ${X_SCLS[*]} )"
> /usr/bin/scl_enabled rh-ror42
> if [ $? != 0 ]; then
>   SCLS+=(rh-ror42)
>   export X_SCLS=$(printf '%q ' "${SCLS[@]}")
> . /opt/rh/rh-ror42//enable
> fi
> "/usr/local/bin/run-jnlp-client" ... 

I would expect last line to be:

> exec "/usr/local/bin/run-jnlp-client" ...

Comment 6 RHEL Program Management 2020-12-15 07:47:06 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.