-
Notifications
You must be signed in to change notification settings - Fork 93
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
[crmsh-4.6] Fix: sh: pass env to child process explicitly (bsc#1205925) #1356
[crmsh-4.6] Fix: sh: pass env to child process explicitly (bsc#1205925) #1356
Conversation
A bug in python stardard library, python/cpython#100516, make environment variables, `COLUMNS` and `ROWS` to be added at fork. These environment variables may make some of the commands called by crmsh to truncate its output even if those commands are not writing to the terminal. Passing argument `env` explicitly is a workaround for the python bug.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## crmsh-4.6 #1356 +/- ##
=============================================
- Coverage 52.82% 52.81% -0.01%
=============================================
Files 79 79
Lines 24002 24011 +9
=============================================
+ Hits 12678 12682 +4
- Misses 11324 11329 +5 ☔ View full report in Codecov by Sentry. |
A bug in python stardard library, python/cpython#100516, make environment variables, `COLUMNS` and `ROWS` to be added at fork. These environment variables may make some of the commands called by crmsh to truncate its output even if those commands are not writing to the terminal. These variables is set when bash enables its `checkwinsize` option. As crmsh is able to read terminal size with curses, these variables are unneeded and may be out of sync with actual terminal size.
A bug in python stardard library, python/cpython#100516, make environment variables, `COLUMNS` and `ROWS` to be added at fork. These environment variables may make some of the commands called by crmsh to truncate its output even if those commands are not writing to the terminal. Passing argument `env` explicitly is a workaround for the python bug.
`os.environ` is captured once from libc on python process startup (when module `os` is imported from `site.py`) and is the only one interface able to enumerate environment variables. Changing environment variables with other interfaces (including `os.putenv`, `os.unsetenv`, or call libc interface in some CPython modules) makes `os.environ` out of sync and should be avoided.
b2eba65
to
1ceec36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Please backport to master
Further experiment shows that the behavior of modifying environ |
The backtrace shows that From
|
A bug in python stardard library, python/cpython#100516, make
environment variables,
COLUMNS
andROWS
to be added at fork. Theseenvironment variables may make some of the commands called by crmsh to
truncate its output even if those commands are not writing to the
terminal.
Passing argument
env
explicitly is a workaround for the python bug.