[Yum-devel] [PATCH] searchPackageProvides(): don't convert search strings to unicode

Mike Bonnet mikeb at redhat.com
Wed Aug 19 22:01:49 UTC 2009


The searchPackageProvides() method is converting the search strs to unicode, which causes any comparisons against utf-8-encoded values returned by sqlite to fail.  Call to_utf() instead to ensure that the values are strs, but in the cases I tested this was a noop.

Testcase:

without the patch:

$ repoquery --repofrompath=f11,http://download.bos.redhat.com/pub/fedora/linux/releases/11/Everything/x86_64/os/ --whatprovides 'font(эвристика)'
Added f11 repo from http:/download.bos.redhat.com/pub/fedora/linux/releases/11/Everything/x86_64/os
/usr/lib/python2.5/site-packages/yum/packages.py:397: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if reqn == n:

(and no results)

with the patch:

$ repoquery --repofrompath=f11,http://download.bos.redhat.com/pub/fedora/linux/releases/11/Everything/x86_64/os/ --whatprovides 'font(эвристика)'
Added f11 repo from http:/download.bos.redhat.com/pub/fedora/linux/releases/11/Everything/x86_64/os
apanov-heuristica-fonts-0:20090125-5.fc11.noarch

---
 yum/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 0df32a3..4dda209 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1977,7 +1977,7 @@ class YumBase(depsolve.Depsolve):
         
         matches = {}
         for arg in args:
-            arg = to_unicode(arg)
+            arg = misc.to_utf8(arg)
             if not misc.re_glob(arg):
                 isglob = False
                 if arg[0] != '/':
-- 
1.6.0.6


More information about the Yum-devel mailing list