forked from Mirror/pmbootstrap
Fix "pmbootstrap chroot" and others not passing the proxy environment
variables correctly. Thanks to notfound405 for pointing this out!
Instead of only preserving proxy environment variables in
pmb.helpers.run_core, which should never be called directly, do it in
the calling functions:
* pmb.helpers.run.user
* pmb.helpers.run.root
* pmb.chroot.root
* pmb.chroot.user
This fixes that the environment variables were only really passed by
pmb.helpers.run.user, because the other functions would result in
something like:
HTTP_PROXY=mytestproxy sudo env -i /usr/bin/sh -c '…'
This is needed to either elevate to root, or to elevate to root first
and then enter the chroot as root or user. Due to the "env -i", the
environment intentionally gets cleaned, but unintentionally also removes
the proxy environment variables that were explicitly set.
By adjusting the functions, they now run a variant of:
sudo env -i /usr/bin/sh -c 'HTTP_PROXY=mytestproxy …'
The escaping is simplified in this example, run "pmbootstrap -v" to see
the not very readable, but proper escaping with shutil.quote().
Remove the previous test for preserving the environment variables in
pmb.helpers.run_core (as it should never be called directly), and test
instead the new behavior.
Fixes: issue 2299
Fixes:
|
||
---|---|---|
.. | ||
pmb_test | ||
testdata | ||
pytest.ini | ||
test_apk.py | ||
test_apk_static.py | ||
test_aportgen.py | ||
test_aportgen_device_wizard.py | ||
test_arguments.py | ||
test_bootimg.py | ||
test_build_is_necessary.py | ||
test_build_package.py | ||
test_chroot_interactive_shell.py | ||
test_chroot_mount.py | ||
test_config_init.py | ||
test_config_pmaports.py | ||
test_config_user.py | ||
test_config_workdir.py | ||
test_envkernel.py | ||
test_file.py | ||
test_folder_size.py | ||
test_frontend.py | ||
test_helpers_git.py | ||
test_helpers_lint.py | ||
test_helpers_package.py | ||
test_helpers_pmaports.py | ||
test_helpers_repo.py | ||
test_helpers_repo_missing.py | ||
test_helpers_status.py | ||
test_helpers_ui.py | ||
test_install.py | ||
test_mount.py | ||
test_newapkbuild.py | ||
test_parse_apkbuild.py | ||
test_parse_apkindex.py | ||
test_parse_depends.py | ||
test_parse_deviceinfo.py | ||
test_parse_kconfig.py | ||
test_pkgrel_bump.py | ||
test_proxy.py | ||
test_qemu_running_processes.py | ||
test_questions.py | ||
test_run_core.py | ||
test_shell_escape.py | ||
test_version.py | ||
test_version_validate.py | ||
test_zzz_keys.py |