SA Bugzilla – Bug 4670
[review] sa-learn: Fails on --restore using sdbm
Last modified: 2005-12-19 08:25:40 UTC
sa-learn tries to rename bayes_seen.convertPID to bayes_seen, but the SDBM backend creates bayes_seen.convertPID.pag and bayes_seen.convertPID.dir instead. ---------------------------------- got bit by this one as well. [22472] dbg: bayes: tie-ing to DB file R/W /home/kevint/.spamassassin/bayes_toks [22472] dbg: bayes: tie-ing to DB file R/W /home/kevint/.spamassassin/bayes_seen [22472] dbg: bayes: found bayes db version 3 [22472] dbg: bayes: untie-ing [22472] dbg: bayes: untie-ing db_toks [22472] dbg: bayes: untie-ing db_seen [22472] dbg: bayes: files locked, now unlocking lock [22472] dbg: locker: safe_unlock: unlocked /home/kevint/.spamassassin/bayes.mutex [22472] dbg: bayes: error while renaming /home/kevint/.spamassassin/bayes_toks.convert22472 to /home/kevint/.spamassassin/bayes_toks: No such file or directory
For what it's worth, I just ran into this myself. It seems the fundamental problem is that sa-learn --restore is unaware of the .dir and .pag files used by SDBM, and thinks it uses the same single-file format that DB_File uses. So it's trying to rename bayes_toks.convert<PID> -> bayes_toks and bayes_seen.convert<PID> -> bayes_seen Really it should be trying to rename: bayes_toks.convert<PID>.dir -> bayes_toks.dir bayes_toks.convert<PID>.pag -> bayes_toks.pag bayes_seen.convert<PID>.dir -> bayes_seen.dir bayes_seen.convert<PID>.pag -> bayes_seen.pag As a short-term workaround, I was able to use sa-learn --restore and manually rename the failed files to their correct names and everything worked fine from there on. However, if you're going to do this manual move, make sure to back up the existing files and make no SA processes are running, as there's no locking or mutexes here. If another SA process was to update the DB as you were copying, corruption could easily result.
the restore_database subroutine makes some assumptions, incorrectly, about the file extensions. We'll either need to just override the restore stuff or fix it up so that it is more aware of the fact that SDBM can have multiple files/extensions.
Created attachment 3310 [details] Patch File Creates a couple of little helper methods to allow for proper unlinking and renaming.
Ready for review for 3.1.1
+1
Now fixed in trunk and 3.1 branch.