From c1ecc482972221c5a58a7f163036ac4931242e3a Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Wed, 13 May 2020 10:48:09 -0400 Subject: [PATCH] rtutil: Avoid loading from a URI in RTLinkCache.setup. See comments for rationale. RT#10543. --- conservancy_beancount/rtutil.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conservancy_beancount/rtutil.py b/conservancy_beancount/rtutil.py index 28a87ef..abf8f23 100644 --- a/conservancy_beancount/rtutil.py +++ b/conservancy_beancount/rtutil.py @@ -116,8 +116,13 @@ class RTLinkCache(_LinkCache): db.close() db = sqlite3.connect(':memory:', isolation_level=None) cursor = db.cursor() + # It would better to use + # '{}?mode=ro'.format(cache_path.as_uri()) + # as the argument here, but that doesn't work on SUSE 15, + # possibly because its sqlite doesn't recognize query + # arguments (added to upstream sqlite in late 2016). cursor.execute('ATTACH DATABASE ? AS readsource', - ('{}?mode=ro'.format(cache_path.as_uri()),)) + (os.fspath(cache_path),)) cursor.execute(cls.CREATE_TABLE_SQL) cursor.execute('INSERT INTO RTLinkCache SELECT * FROM readsource.RTLinkCache') cursor.execute('DETACH DATABASE readsource')