Spamassassin fails to escape backslashes for latest postgres input syntax
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
spamassassin (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
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=
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-
--- spamassassin-
+++ spamassassin-
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-
Looks like maybe this upstream bug: https:/ /issues. apache. org/SpamAssassi n/show_ bug.cgi? id=5730
If so, then this should be fixed in spamassassin 3.2.5, which is in hardy-backports (if you're using hardy... although I don't see a spamassassin 3.2.3 published in any current Ubuntu release). Ian, has this been fixed for you?