Bug 1790174

Summary: virtualenv activate chokes when run from bash scripts in strict mode due to missing PS1
Product: Red Hat Enterprise Linux 8 Reporter: Sorin Sbarnea <ssbarnea>
Component: python-virtualenvAssignee: Python Maintainers <python-maint>
Status: CLOSED WONTFIX QA Contact: RHEL CS Apps Subsystem QE <rhel-cs-apps-subsystem-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.3CC: cstratak, mhroncok, pviktori, vstinner, whayutin
Target Milestone: rc   
Target Release: 8.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-25 14:32:28 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:

Description Sorin Sbarnea 2020-01-12 09:33:18 UTC
Description of problem:

That is known bug that was fixed more than an ago in upstream virtualenv but our outdated version still has it.


Version-Release number of selected component (if applicable):
python3-virtualenv-15.1.0-19.module+el8.1.0+3514+14e79d98.noarch


How reproducible:


Steps to Reproduce:

yum install -y virtualenv
virtualenv venv
# Activate bash strict mode:
set -u
source bin/activate

Actual results:

If you are on a ssh connection, it will be dropped because shells exists on the error.

If this happens inside a script, you will see something like 
https://bugs.launchpad.net/bugs/1858890


Expected results:

Success regardless if `set -eu` are set or not.

Additional info:

This bug directly affected OpenStack as got it reported at https://bugs.launchpad.net/bugs/1858890

I recommend bumping virtualenv version because in the last two years their QA improved considerably and they fixed lots of bugs. AFAIK they did not introduce any breaking changes in virtualenv.

Comment 1 Petr Viktorin (pviktori) 2020-01-14 14:24:44 UTC
How much priority should this have? Do you need it for RHEL 8.2?

We will not be rebasing virtualenv to a newer version, but we can backport an individual patch.

Comment 3 Sorin Sbarnea 2020-01-14 18:40:17 UTC
Using non-default python would not be an option for openstack.

Still, that bug can be bypassed if we backport a single patch: https://github.com/pypa/virtualenv/pull/922/files

Comment 4 Sorin Sbarnea 2020-01-21 18:23:19 UTC
I think I already provided enough info.

Comment 5 Miro HronĨok 2020-01-21 19:02:55 UTC
How much priority should this have? Do you need it for RHEL 8.2?

Comment 6 wes hayutin 2020-01-21 19:15:25 UTC
Yes.. please ship the fix in 8.2

Comment 8 Victor Stinner 2020-01-27 09:56:35 UTC
Is virtualenv still relevant when python3 -m venv is available? venv doesn't seem to have the issue.

I cannot reproduce the issue if I use venv instead of virtualenv, on RHEL 8.2 Beta and Python 3.6.8 (python36-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64):

$ python3
Python 3.6.8 (default, Dec  5 2019, 15:45:45) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.

$ python3 -m venv env
$ set -u
$ source env/bin/activate
(env) $ exit

--

Note: I cannot reproduce this issue on Fedora 31 with Python 3.7.6 (python3-3.7.6-1.fc31.x86_64) neither:

$ python3 -m venv env
$ set -u
$ source env/bin/activate
(env) $ exit

Comment 9 Petr Viktorin (pviktori) 2020-01-28 14:36:51 UTC
We do not have enough information to request a Blocker/Exception needed to get this into RHEL 8.2. Urgent priority on Bugzilla is not a proper business justification.
If you need it in RHEL 8.2, please request the Blocker/Exception from PM.

Comment 10 Petr Viktorin (pviktori) 2020-02-11 14:23:23 UTC
Sorin, if you need this in 8.2, blease coordinate with PM to get the Blocker/Exception.

Comment 13 Sorin Sbarnea 2020-02-19 08:26:05 UTC
8.3 is ok, please assure you include 20.0.4 for it as it includes lots of important (useful) features. Not doing so it will only create problems for us, like forcing us to upgrade it from pip for testing.

PS. I am referring to the python3-virtualenv, the packaging for default python interpreter. If done for all the better.

Comment 14 Petr Viktorin (pviktori) 2020-02-19 10:01:13 UTC
We are not planning to update python3-virtualenv in RHEL 8 to new releases. RHEL is stable; it does not get the newest releases of components.

If there are specific important features you need in python3-virtualenv, please open bugs for them to be backported.

Comment 16 Petr Viktorin (pviktori) 2020-02-25 14:32:28 UTC
Please re-open if you need some specific features to be backported.