summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-09-27 11:23:53 -0700
committerGitHub <noreply@github.com>2018-09-27 11:23:53 -0700
commitace85a44a4839fd0907d983a29b59f4eb7bf9485 (patch)
treea89b97849362b1eac77d3574eab857cb47e86ca3
parent8daa1c6598182777802eba6a74928f28a32f6835 (diff)
parent348cc974110f494527663e72ffd89a41ecd66471 (diff)
downloadchef-ace85a44a4839fd0907d983a29b59f4eb7bf9485.tar.gz
Merge pull request #7696 from MsysTechnologiesllc/nimesh/MSYS-866_handling_spaces_in_package
Minor optimization in yum_helper.py to avoid RPM DB corruption under certain scenarios
-rw-r--r--lib/chef/provider/package/yum/yum_helper.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/provider/package/yum/yum_helper.py b/lib/chef/provider/package/yum/yum_helper.py
index d2c04c72db..7e99951555 100644
--- a/lib/chef/provider/package/yum/yum_helper.py
+++ b/lib/chef/provider/package/yum/yum_helper.py
@@ -125,8 +125,9 @@ def query(command):
# - in order to fix this, something would have to happen where getProvides was called first and
# then the result was searchNevra'd. please be extremely careful if attempting to fix that
# since searchNevra does not support prco tuples.
- if any(elem in command['provides'] for elem in r"<=>"):
- # handles flags (<, >, =, etc) and versions, but no wildcareds
+ if bool(re.search('\\s+', command['provides'])):
+ # handles flags (<, >, =, etc) and versions, but no wildcareds
+ # raises error for any invalid input like: 'FOO BAR BAZ'
pkgs = obj.getProvides(*string_to_prco_tuple(command['provides']))
elif do_nevra:
# now if we're given version or arch properties explicitly, then we do a SearchNevra.