[oe-commits] [bitbake] branch master-next updated: persist_data: Return str instead of unicode for sqlite3 text queries

git at git.openembedded.org git at git.openembedded.org
Tue Apr 5 13:39:32 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

The following commit(s) were added to refs/heads/master-next by this push:
       new  09623a0   persist_data: Return str instead of unicode for sqlite3 text queries
09623a0 is described below

commit 09623a0811c613a47a01ae465b822d8156faca30
Author: Klauer, Daniel <Daniel.Klauer at gin.de>
AuthorDate: Tue Apr 5 08:49:15 2016 +0000

    persist_data: Return str instead of unicode for sqlite3 text queries
    
    Python 2's sqlite3 module defaults to returning Unicode strings for SQL
    text queries, which could trickle down to other parts of bitbake code and
    cause unexpected Unicode conversions. Using byte strings avoids this issue.
    
    For example, the git fetcher's AUTOREV support caches HEAD SHA1's using
    bb.persist_data, so sometimes the git command strings passed to fetch2's
    runfetchcmd() were unicode, potentially causing UnicodeDecodeErrors when
    it appended the values of environment variables containing non-ASCII chars.
    
    [YOCTO #9382]
    
    Signed-off-by: Daniel Klauer <daniel.klauer at gin.de>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/persist_data.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py
index 5795bc8..e450423 100644
--- a/lib/bb/persist_data.py
+++ b/lib/bb/persist_data.py
@@ -201,6 +201,7 @@ class PersistData(object):
 def connect(database):
     connection = sqlite3.connect(database, timeout=5, isolation_level=None)
     connection.execute("pragma synchronous = off;")
+    connection.text_factory = str
     return connection
 
 def persist(domain, d):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list