summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/persist_data.py
diff options
context:
space:
mode:
authorKlauer, Daniel <Daniel.Klauer@gin.de>2016-04-05 08:49:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-06 10:29:47 +0100
commit4f07c2220bedf50743bc384dd221eb14f6b0b300 (patch)
treed890f506e4d0a30b7d439b6028b372f1e41e3869 /bitbake/lib/bb/persist_data.py
parentd8f1f428bdbcc3624e4c0e0881f9c82ae9940a16 (diff)
downloadpoky-4f07c2220bedf50743bc384dd221eb14f6b0b300.tar.gz
bitbake: 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] (Bitbake rev: 09623a0811c613a47a01ae465b822d8156faca30) Signed-off-by: Daniel Klauer <daniel.klauer@gin.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/persist_data.py')
-rw-r--r--bitbake/lib/bb/persist_data.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py
index 5795bc835b..e45042324e 100644
--- a/bitbake/lib/bb/persist_data.py
+++ b/bitbake/lib/bb/persist_data.py
@@ -201,6 +201,7 @@ class PersistData(object):
201def connect(database): 201def connect(database):
202 connection = sqlite3.connect(database, timeout=5, isolation_level=None) 202 connection = sqlite3.connect(database, timeout=5, isolation_level=None)
203 connection.execute("pragma synchronous = off;") 203 connection.execute("pragma synchronous = off;")
204 connection.text_factory = str
204 return connection 205 return connection
205 206
206def persist(domain, d): 207def persist(domain, d):