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.
qof_session_end() is documented to release the session lock and shut the
backend connection but it does not release the session lock in all scenarios
(BUG). qof_session_end() looked the backend up via qof_book_get_backend().
The book's backend pointer is only set by load() or a data-changing save() (an
empty book's save() early-returns before attaching it); begin() sets only the
session's own m_backend. So a session that creates a store and ends it without
loading or making a real change had a backend on the session but not on the
book: end() found none, skipped session_end(), and never released the lock --
it was only released later at destroy().
Because the fault is in backend-agnostic engine code it affects every backend
that locks at begin(): the SQL/DBI backends leave a stale row in the gnclock
table, and the XML/file backend leaves an abandoned <file>.LCK sentinel (with
no data file, since XML data is only written at save). The store then appears
locked to the next opener.
End the session's own backend (m_backend, always set at begin()) instead. It
already equals the book's backend whenever the latter is set, so the change is
a no-op for loaded/saved sessions and additionally covers the
created-but-not-attached case.
Add regression tests for both backends, each of which begins a create-mode
session, ends it without a data-changing save, and checks the lock is gone:
- test-backend-dbi-basic.cpp (test_dbi_new_store_end_releases_lock): reopens
the store and asserts it is not ERR_BACKEND_LOCKED.
- test-load-backend.cpp (test_new_store_end_releases_lock): asserts the XML
<file>.LCK lockfile has been removed.
file has backslash just before final quote in a quoted field
https://bugs.gnucash.org/show_bug.cgi?id=799774
Added a checkbox to the "File Format" section of the "Import Preview" step
of the CSV Import Assistant. This checkbox is labeled "Enable escape character"
and is enabled by default. If this checkbox is not enabled, GncCsvTokenizer
will insert an escape character (backslash) before any escape found in the
input which will prevent boost::tokenizer with escaped_list_separator from
processing this backslash as part of an escape sequence.
Ensured that saved import settings that have no current value for the
new "EnableEscape" field will set the "Enable escape character" checkbox.
Changed the test framework in GncTokenizerTest to specify whether escape
characters are enabled, and added test cases for escape characters disabled.
When we change the original "Statement Date" and set the "Ending Balance" to the original "Ending Balance", the "Reconcile" window will inappropriately reset the "Ending Balance" to the balance at the new "Statement Date".
If the acct list had duplicates, previous impl would include their
splits only once. if we scan account splits manually we must avoid
scanning the same account multiple times.
Rebuilding the po files after the force-push inserted a lot of
incorrect translators, set many of the Last Translator headers to
me, and set the wrong GnuCash version."