Bug 278669 - games/xmoto: Crashes at startup if DQS option off for sqlite3
Summary: games/xmoto: Crashes at startup if DQS option off for sqlite3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Marakasov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-30 19:22 UTC by Dave Vasilevsky
Modified: 2024-05-15 19:19 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (amdmi3)


Attachments
Fix xmoto DB access (1.63 KB, patch)
2024-05-01 21:38 UTC, Dave Vasilevsky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Vasilevsky 2024-04-30 19:22:09 UTC
By default, the sqlite3 port has the DQS option off. Unfortunately, xmoto uses double-quoting for strings, for example in getXmParameterKey: https://github.com/xmoto/xmoto/blob/v0.6.2/src/db/xmDatabase.cpp#L329

This causes xmoto to crash at startup with either:
- "no such column: siteKey" if no existing xmoto DB is present, or
- "no such column: xmdb_version" if there is an existing DB

This should be reported upstream, I'll look into it. For now, we could patch xmDatabase::open to add `sqlite3_db_config(m_db, SQLITE_DBCONFIG_DQS_DML, 1 NULL);`
Comment 1 Dave Vasilevsky 2024-04-30 19:34:38 UTC
PR for upstream: https://github.com/xmoto/xmoto/pull/188
Comment 2 Dave Vasilevsky 2024-04-30 19:52:56 UTC
PR submitted against ports repo here: https://github.com/freebsd/freebsd-ports/pull/254
Comment 3 Robert Clausecker freebsd_committer freebsd_triage 2024-05-01 18:59:32 UTC
Thank you for looking into this.

Could you add your patch against the ports tree (using git-format-patch if possible) to this bug report?  This is the preferred way of submitting patches.
Comment 4 Dave Vasilevsky 2024-05-01 21:37:31 UTC
Yup, Github has this great feature where if you add ".patch" to the end of a PR URL you get the formatted plain-text version: https://patch-diff.githubusercontent.com/raw/freebsd/freebsd-ports/pull/254.patch

This is already against the ports tree.
Comment 5 Dave Vasilevsky 2024-05-01 21:38:31 UTC
Created attachment 250324 [details]
Fix xmoto DB access

For your convenience, I've also attached the patch against the ports tree.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-05-14 01:46:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=52371ce420c779e73cd2feb68bd8627508fde655

commit 52371ce420c779e73cd2feb68bd8627508fde655
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2024-05-06 13:07:33 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2024-05-14 01:44:10 +0000

    games/xmoto: fix sqlite related startup crash

    PR:             278669
    Submitted by:   dave@vasilevsky.ca
    Upstream PR:    https://github.com/xmoto/xmoto/pull/188/files

 games/xmoto/Makefile                                |  2 +-
 games/xmoto/files/patch-src_db_xmDatabase.cpp (new) | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)