[Bug 375490] [NEW] Spamassassin fails to escape backslashes for latest postgres input syntax
Ian Turner
vectro at vectro.org
Tue May 12 15:02:28 UTC 2009
Public bug reported:
Using:
- Spamassassin
- Postgres
- DBI
- DBD:Pg
I get the following error when attempting to sa-learn --restore:
[24850] dbg: bayes: tok_get: SQL error: ERROR: invalid input syntax for type bytea
[24850] dbg: bayes: _put_token: SQL error: ERROR: invalid input syntax for type bytea
[24850] dbg: bayes: error inserting token for line: t 1 0 1240037056 0178865c33
When run with DBI_TRACE=3, I get the following output:
-> execute for DBD::Pg::st (DBI::st=HASH(0x99b9c24)~0x99c6f60 '8' '.^M<E4>\<8C>') thr#
814e008
dbdpg: ERROR: invalid input syntax for type bytea
The problem is that Postgres 8.3 is expecting the backslash to be
escaped if it represents a literal backslash. The following patch seems
to resolve the problem, and I think it is backward-compatible, though
not necessarily compatible with SQLite or MySql:
--- spamassassin-3.2.3-0.volatile/lib/Mail/SpamAssassin/BayesStore/SQL.pm 2009-05-12 14:58:28.000000000 +0000
+++ spamassassin-fixed/lib/Mail/SpamAssassin/BayesStore/SQL.pm 2009-05-12 14:07:21.000000
000 +0000
@@ -1522,6 +1522,8 @@
else {
# turn unpacked binary token back into binary value
$token = pack("H*",$token);
+ # Escape backslashes for DB's benefit
+ $token =~ s/\\/\\0134/g;
}
unless ($self->_put_token($token, $spam_count, $ham_count,
$atime)) {
** Affects: spamassassin (Ubuntu)
Importance: Undecided
Status: New
** Tags: patch
--
Spamassassin fails to escape backslashes for latest postgres input syntax
https://bugs.launchpad.net/bugs/375490
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
More information about the universe-bugs
mailing list