New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
activate may fails due to unbound variables when run with set -eu #1029
Comments
I am also finding this, running virtualenv 15.1.0. I'm using an environment within a Nextflow pipeline, and Nextflow runs in strict mode by default (nextflow-io/nextflow#302). While Nextflow can be reconfigured to run without strict mode, I agree with the Nextflow developer that it would be preferable to avoid using unbound variables, if possible. I'm not sure exactly how the |
I am wondering how many years it would take to learn how to write bash code.... the unbound variable bugs in virtualenv are eons old and so easy to fix and to also AVOID them in the future by just adding a simple line to the virtual tests: Not to mention how many years it will take for the fix to reach all virtualenv distros around there as that's usually packaged on debian, ubuntu, centos, rhel, fedora, .... :( :( :( |
will the project maintainers even acknowledge this issue exists? |
I don't know but considering that we also got a PR which is almost two weeks old. The most likely answer is that they don't give a... submit. |
I am going to try to make some noise on irc, twitter, maybe even mailing list. Maybe we can get the fixes merged. virtualenv is the only thing that prevent me from making the bash strict mode default on CI jobs. |
+1 I think just disabling |
@jakub-bochenski maybe you can also help with some comments on irc. Let's see if we can get enough users to wake a virtualenv core dev. |
@ssbarnea not sure about that, I haven't logged in to IRC for ages. I can try to help generate buzz on the mailing list though |
sigh... +1 |
I emailed pypa-dev 7 days ago and didn't get any reply. Also yesterday someone posted that the installed win32 binary contains a trojan, again no reply. I only hope that the trojan was not really into the distro, not that it would affect me. |
When shell (bash or compatible) is run with `set -ue` mode, activate can fail due to unbound variabled. Fixes pypa#1029 Change-Id: I764297341dee69a01bd4044d6567dee1026499d2
Ran into this today, figured it was a bug in my code somewhere. |
for reference the direct link to discussion mentioned above is: https://groups.google.com/d/topic/pypa-dev/8iVHDOqsj9M/discussion @pfmoore wrote
.. which turned out to be the python-virtualenv list; https://groups.google.com/d/topic/python-virtualenv/5xKG8KoBl6g/discussion |
FWIW, the workaround I'm using in .devkit is to set |
When shell (bash or compatible) is run with `set -ue` mode, activate can fail due to unbound variabled. Fixes pypa#1029 Change-Id: I764297341dee69a01bd4044d6567dee1026499d2
@pjeby @jakub-bochenski @jpuskar @axd1967 Please note that we already have a bugfix for this but in order to merge it we need to review and merge two other PRs, that's only because we do want and need to improve the activate test-suite.
Probably you will see that the last two are not passing CI tests, that's why we need the others merged first. Please review/comment on them, it matters more than on other project because virtualenv lacks some reviewing power, this being one of the reasons why I asked to become a maintainer at https://groups.google.com/d/msg/pypa-dev/SgK9vlu93BY/F2_8OoKAAgAJ -- even so, it seems that we will need more than one as I would not be able to review my own changes. |
@ssbarnea are you asking us to also get reviewer permissions, or just do a review and leave a +1/comments? EDIT: never mind apparently anyone can review a PR |
When shell (bash or compatible) is run with `set -ue` mode, activate can fail due to unbound variabled. Fixes pypa#1029 Change-Id: I764297341dee69a01bd4044d6567dee1026499d2
When shell (bash or compatible) is run with `set -ue` mode, activate can fail due to unbound variabled. Fixes pypa#1029 Change-Id: I764297341dee69a01bd4044d6567dee1026499d2
1 done 2 more to go :) |
Can we please get an ETA on when this will be merged and publicly available? Edit: Still getting this issue, and it just brought down a build this morning. |
I've also been bitten by this, when working on the build script for an AWS lambda-based image processing solution: https://github.com/awslabs/serverless-image-handler/blob/master/deployment/build-s3-dist.sh I've used the |
@duaneking @robinbowes There is a lack of maintenance power around virtualenv and if you want to help addressing this issue please read and comment on https://groups.google.com/forum/#!topic/pypa-dev/SgK9vlu93BY My impression is that PYPA team will react on this only if it gets enough community feedback. |
FTR we are still waiting for a merge on #1087 |
When running this script in terminal, it fails with errror _OLD_VIRTUAL_PATH, _OLD_VIRTUAL_PYTHONHOME is unbound. when activating virtualenv. Seems like it's known issue in venv: pypa/virtualenv#1029 set +u before activation is a workaround for this issue and then set -u to continue the rest of the script Change-Id: I5095118609f8d2dc46112c3761952a109ba4b93e
* Update tripleo-ci from branch 'master' - Merge "Workaround for virtualenv issue with old variables" - Workaround for virtualenv issue with old variables When running this script in terminal, it fails with errror _OLD_VIRTUAL_PATH, _OLD_VIRTUAL_PYTHONHOME is unbound. when activating virtualenv. Seems like it's known issue in venv: pypa/virtualenv#1029 set +u before activation is a workaround for this issue and then set -u to continue the rest of the script Change-Id: I5095118609f8d2dc46112c3761952a109ba4b93e
Guess what is the first example for Use the Unofficial Bash Strict Mode | Sourcing A Nonconforming Document? Yes, it's python 2 virtualenv. |
Ubuntu 16.04
|
Note that using bogdando/tripleo-ci@318d17a will override the mode to This will preserve the previous state:
|
right now I suggest using patch (use bash or change accordingly for your needs)
|
When shell (bash or compatible) is run in strict mode, activate can fail due to unbound variabled. Includes alternative sed call that is cross GNU/BSD compatible. Fixes pypa#1029 Change-Id: I764297341dee69a01bd4044d6567dee1026499d2
fixed now #922 |
There were a few issues: set -Eeuxo pipefail was not allowing bin/activate to work properly. See this: pypa/virtualenv#1029. That was removed. Then changed all $ to ~ for WDL v1.0
It seems that an old bug is still here:
PS1: unbound variable
when called with bash strict mode.Clearly virtualenv needs a test using bash strict mode and an almost empty set of environment variables, so we avoid future regressions on this.
Please note that this bug does reproduce with ANY supported Unix shell, not only
bash
, includingksh
andzsh
.Here is a simple way to replicate the bug:
The workaround, while ugly, is to do prepend
PS=${PS:-}
to the activate line, which defines PS as empty string when is not already defined, or keeps its value when is defined.The same kind of bug applies to Python version of venv and there is an already open PR to fix it there too.
Please do not postpone/delay implementing a fix just because the same kind of bug exists in other places. Note that the default expansion variable syntax is POSIX compatible and not something new or fancy, the fact that this was not known to the original author should not be an excuse for not using it.
The text was updated successfully, but these errors were encountered: