mirror of https://github.com/ansible/ansible.git
[controller ansiballz] escape directory regex (#74270)
Change: - We were passing a directory name directly to re.compile(). If the directory isn't valid regex (or is) this can have odd side effects, such as crashing. - Fix a few other similar cases, but less likely to be a real issue. Test Plan: - New test Signed-off-by: Rick Elrod <rick@elrod.me>pull/74291/head
parent
cf4a9fcd0f
commit
7ef3dc2b8b
@ -0,0 +1,4 @@
|
||||
bugfixes:
|
||||
- >-
|
||||
ansiballz - avoid treating path to site_packages as regex; escape it.
|
||||
This prevents a crash when ansible is installed to, or running from, an oddly named directory like ``ansi[ble``
|
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# #74270 -- ensure we escape directory names before passing to re.compile()
|
||||
# particularly in module_common.
|
||||
|
||||
set -eux
|
||||
|
||||
lib_path=$(python -c 'import os, ansible; print(os.path.dirname(os.path.dirname(ansible.__file__)))')
|
||||
bad_dir="${OUTPUT_DIR}/ansi[ble"
|
||||
|
||||
mkdir "${bad_dir}"
|
||||
cp -a "${lib_path}" "${bad_dir}"
|
||||
|
||||
PYTHONPATH="${bad_dir}/lib" ansible -m ping localhost -i ../../inventory "$@"
|
||||
rm -rf "${bad_dir}"
|
Loading…
Reference in New Issue