Bug#1112276: trixie-pu: package presage/0.9.1-2.6+deb13u1
Package: release.debian.org
Severity: normal
Tags: trixie
X-Debbugs-Cc: presage@packages.debian.org
Control: affects -1 + src:presage
User: release.debian.org@packages.debian.org
Usertags: pu
[ Reason ]
During tests of Lomiri in trixie on real tablet hardware I observed
session crashes when typing text into certain text fields (e.g. URL
input fields). It was the first time I tested Lomiri in English on
Debian (before I mostly tested in German/Dutch).
After some research I realized that I had presage (word suggestions in
on-screen-keyboard) enabled. By default, presage is disabled.
It turned out that presage was causing crashes of lomiri-keyboard (OSK)
on word suggestions that contain apostrophes due to mis-created sqlite3
queries. The lomiri-keyboard crashes were co-crashing the Lomiri session
altogether.
[ Impact ]
Lomiri crashes on text input via OSK if word suggestions are enabled.
[ Tests ]
Manual tests on real tablet hardware. Cross-checked with Guido
Günther (for Phosh in Debian). Patch works there, as well, not causing any
regressions.
[ Risks ]
Mainly for Lomiri users and Phosh uses if using the on-screen keyboard
of those environments.
[ Checklist ]
[x] *all* changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in (old)stable
[x] the issue is verified as fixed in unstable
[ Changes ]
(Explain *all* the changes)
+ * debian/patches:
+ + Add allow-words-with-apostrophes-to-be-predicted.patch. Support suggesting
+ words containing apostrophes. Don't crash maliit-server / lomiri-keyboard
+ / lomiri when using /usr/lib/lomiri-keyboard/plugins/en/database_en.db
+ presage DB. (Closes: #770831, LP:#1384800).
[ Other info ]
Highly relevant for Lomiri in Debian.
diff -Nru presage-0.9.1/debian/changelog presage-0.9.1/debian/changelog
--- presage-0.9.1/debian/changelog 2023-10-12 15:24:57.000000000 +0200
+++ presage-0.9.1/debian/changelog 2025-08-11 17:02:57.000000000 +0200
@@ -1,3 +1,13 @@
+presage (0.9.1-2.6+deb13u1) trixie; urgency=medium
+
+ * debian/patches:
+ + Add allow-words-with-apostrophes-to-be-predicted.patch. Support suggesting
+ words containing apostrophes. Don't crash maliit-server / lomiri-keyboard
+ / lomiri when using /usr/lib/lomiri-keyboard/plugins/en/database_en.db
+ presage DB. (Closes: #770831, LP:#1384800).
+
+ -- Mike Gabriel <sunweaver@debian.org> Mon, 11 Aug 2025 17:02:57 +0200
+
presage (0.9.1-2.6) unstable; urgency=medium
* Non-maintainer upload.
diff -Nru presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch
--- presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch 1970-01-01 01:00:00.000000000 +0100
+++ presage-0.9.1/debian/patches/allow-words-with-apostrophes-to-be-predicted.patch 2025-08-11 17:01:43.000000000 +0200
@@ -0,0 +1,59 @@
+Description: Allow words with apostrophes to be predicted
+ Stop the tokenizer from splitting based on apostrophes and allow for the
+ escaping of words containing apostrophes in the database connector.
+Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+Forwarded: https://sourceforge.net/p/presage/patches/2/
+Bug-Ubuntu: https://launchpad.net/bugs/1384800
+Comment:
+ Derived from an earlier patch version by Michael Sheldon
+ <michael.sheldon@canonical.com> (dropping libboost as
+ build requirement).
+
+
+--- a/src/lib/core/charsets.h
++++ b/src/lib/core/charsets.h
+@@ -180,7 +180,6 @@
+ '$',
+ '%',
+ '&',
+- '\'',
+ '(',
+ ')',
+ '*',
+--- a/src/lib/predictors/dbconnector/databaseConnector.cpp
++++ b/src/lib/predictors/dbconnector/databaseConnector.cpp
+@@ -293,12 +293,17 @@
+
+ std::string DatabaseConnector::sanitizeString(const std::string str) const
+ {
+- // TODO
+- // just return the string for the time being
+- // REVISIT
+- // TO BE DONE
+- // TBD
+- return str;
++ std::string sanitized = str;
++ const std::string search = "'";
++ const std::string replace = "''";
++
++ // Escape single quotes
++ size_t pos = 0;
++ while ((pos = sanitized.find(search, pos)) != std::string::npos) {
++ sanitized.replace(pos, search.length(), replace);
++ pos += replace.length();
++ }
++ return sanitized;
+ }
+
+ int DatabaseConnector::extractFirstInteger(const NgramTable& table) const
+--- a/src/tools/text2ngram.cpp
++++ b/src/tools/text2ngram.cpp
+@@ -174,7 +174,7 @@
+ std::ifstream infile(argv[i]);
+ ForwardTokenizer tokenizer(infile,
+ " \f\n\r\t\v ",
+- "`~!@#$%^&*()_-+=\\|]}[{'\";:/?.>,<«»");
++ "`~!@#$%^&*()_-+=\\|]}[{\";:/?.>,<«»");
+ tokenizer.lowercaseMode(lowercase);
+
+ // take care of first N-1 tokens
diff -Nru presage-0.9.1/debian/patches/fix-bug-776720.patch presage-0.9.1/debian/patches/fix-bug-776720.patch
--- presage-0.9.1/debian/patches/fix-bug-776720.patch 2022-11-27 14:02:27.000000000 +0100
+++ presage-0.9.1/debian/patches/fix-bug-776720.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,17 +0,0 @@
-Fix bug #776720
---- a/apps/gtk/gprompter/Makefile.am
-+++ b/apps/gtk/gprompter/Makefile.am
-@@ -253,10 +253,10 @@
- gprompter_CFLAGS = $(GNOME_CFLAGS) $(GTHREAD_CFLAGS) $(GMODULE_CFLAGS) \
- -I$(top_srcdir)/src/lib \
- -I$(srcdir)/scintilla/include
--gprompter_LDADD = $(GNOME_LIBS) $(GTHREAD_LIBS) $(GMODULE_LIBS) \
-- -lm \
-+gprompter_LDADD = libscintilla.la \
- ../../../src/lib/libpresage.la \
-- libscintilla.la
-+ $(GNOME_LIBS) $(GTHREAD_LIBS) $(GMODULE_LIBS) \
-+ -lm
- if USE_GCC
- gprompter_LDADD += -lstdc++
- endif
diff -Nru presage-0.9.1/debian/patches/series presage-0.9.1/debian/patches/series
--- presage-0.9.1/debian/patches/series 2023-10-12 15:24:57.000000000 +0200
+++ presage-0.9.1/debian/patches/series 2025-08-11 17:02:57.000000000 +0200
@@ -4,3 +4,4 @@
sfos/docs-Install-css-too.patch
sfos/text2ngram-Add-and-to-separators.patch
sfos/text2ngram-Add-non-breaking-space-to-whitespace-chars.patch
+allow-words-with-apostrophes-to-be-predicted.patch
Reply to: