[Yum-devel] [PATCH] configure sqlite to return utf-8-encoded strs instead of unicode objects

James Antill james at fedoraproject.org
Thu Aug 6 21:25:42 UTC 2009


On Thu, 2009-08-06 at 13:50 -0400, Mike Bonnet wrote:
> sqlite by default returns all text as unicode objects, and this causes a 
> number of problems when merging repos which contain utf-8 characters in 
> Provides or Requires (as the current F11/F12 repos do).  For a testcase, 
> try merging 2 F12 repos, and you should see it fail with a 
> UnicodeDecodeError in packages.py:_dump_pco().  This patch instructs 
> sqlite to return all text as utf-8-encoded strs, which avoids these 
> encoding issues.

 Ugh. While it would be nice to move everything to utf8, the timing here
seems bad ... in that it seems to close to F12/RHEL-6 to do this kind of
change without a good idea it isn't going to break anything else.

 So what testing did you do to see what else it broke?
 For instance, does "yum search ®" still work?
 Did you test with any weird LANG= values?
 I'm pretty sure you didn't test with ./test/yum-release-i18n-test.sh,
but if you did that'd be cool.

 How much did you look for more local change that would make mergerepo
happy?

> ---
>   sqlitecachec.py |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/sqlitecachec.py b/sqlitecachec.py
> index 7ed5056..8b0ca08 100644
> --- a/sqlitecachec.py
> +++ b/sqlitecachec.py
> @@ -29,6 +29,7 @@ class RepodataParserSqlite:
>           if not filename:
>               return None
>           con = sqlite.connect(filename)
> +        con.text_factory = str
>           if sqlite.version_info[0] > 1:
>               con.row_factory = sqlite.Row
>           cur = con.cursor()
-- 
James Antill <james at fedoraproject.org>
Fedora


More information about the Yum-devel mailing list