gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Jul 11 14:02:06 EDT 2026


Updated	 via  https://github.com/Gnucash/gnucash/commit/13d8da31 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f056be14 (commit)
	from  https://github.com/Gnucash/gnucash/commit/b3e80748 (commit)



commit 13d8da3116a71fe001c0aa01b8d067bae8dc07b1
Merge: b3e8074890 f056be140c
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Jul 11 11:00:35 2026 -0700

    Merge Noah Noerr's 'readonly-skip-dbi-library-test' into stable.


commit f056be140cd9b929d7cd2aef560eeeeb2880f3ac
Author: Noah R <Noerr at users.noreply.github.com>
Date:   Fri Jul 10 17:52:38 2026 -0700

    [backend/dbi] skip the libdbi integrity probe for read-only sessions
    
    session_begin() runs dbi_library_test() (Bug #611936) on every open to
    detect a libdbi/-ffast-math miscompilation that mangles 64-bit values.
    The probe CREATEs, INSERTs into, SELECTs from and DROPs a temporary
    table, so it needs write privileges on the database -- even for
    SESSION_READ_ONLY. A least-privilege, read-only database user therefore
    cannot open the book at all: the temporary-table create fails and
    session_begin returns ERR_SQL_DBI_UNTESTABLE.
    
    The defect the probe guards against is on the write side of libdbi, so it
    can be neither triggered nor detected by a read-only session, which never
    writes. Skip the probe when the session is opened SESSION_READ_ONLY, at
    the two call sites a read-only open reaches (the SQLite session_begin and
    the shared MySQL/PostgreSQL session_begin); the third call site is inside
    the create branch, which read-only never enters. The write-capable modes
    (NORMAL_OPEN, NEW_STORE, NEW_OVERWRITE, BREAK_LOCK) still run the probe
    unchanged.
    
    This lets a SELECT-only database user open a book read-only through the API.

diff --git a/libgnucash/backend/dbi/gnc-backend-dbi.cpp b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
index 08c0baa805..cbc2f3d820 100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
@@ -425,7 +425,7 @@ GncDbiBackend<DbType::DBI_SQLITE>::session_begin(QofSession* session,
         return;
     }
 
-    if (!conn_test_dbi_library(conn))
+    if (mode != SESSION_READ_ONLY && !conn_test_dbi_library(conn))
     {
         if (create && !file_exists)
         {
@@ -677,7 +677,7 @@ GncDbiBackend<Type>::session_begin (QofSession* session, const char* new_uri,
     {
         if (Type == DbType::DBI_MYSQL)
             adjust_sql_options (conn);
-        if(!conn_test_dbi_library(conn))
+        if (mode != SESSION_READ_ONLY && !conn_test_dbi_library(conn))
         {
             dbi_conn_close(conn);
             LEAVE("Error");



Summary of changes:
 libgnucash/backend/dbi/gnc-backend-dbi.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list