SA Bugzilla – Bug 2917
[review] Failure to remove /tmp/spamd-$$-init for certain settings of auto_whitelist_path (and bayes_path)
Last modified: 2004-01-11 02:29:27 UTC
Upon starting, spamd fails to remove the directory /tmp/spamd-$$-init if auto_whitelist_path (or, presumably, bayes_path) are set to write their respective files into that directory itself rather than its ".spamassassin" subdirectory using the following configuration setting in local.cf: auto_whitelist_path ~/auto-whitelist spamd writes the following message to the system log: Failed to remove /tmp/spamd-10877-init: Could not remove /tmp/spamd-10877-init: Directory not empty The directory remains in /tmp containing only the files auto-whitelist.dir and auto-whitelist.dir.
preload_modules_with_tmp_homedir deletes all files in $tmpsadir before trying to remove $tmpsadir and $tmphome themselves. It never tries to delete files in $tmphome itself before attempting to remove it. Certain (valid) configuration settings might leave files in there though. preload_modules_with_tmp_homedir should either *recursively* delete files and directories starting in $tmphome, or should at least try to delete files in $tmphome *as well* after deleting those in $tmpsadir.
You're right, I'll have this fixed in a minute :)
moving to 2.62
Created attachment 1672 [details] The patch. Here it is. Michael, could you please test it?
I really wonder *why* that patch works for me as there's an obvious typo in there...
Created attachment 1673 [details] The Real Patch(tm) without the typo. A wise man once said: You shall not drink and code. And watch out which repository you test against if you've got several on your disk.
It works *almost* like a charm. It works perfectly after fixing the following buglet that remained from the original code: $f = Mail::SpamAssassin::Util::untaint_file_path ( File::Spec->catfile ($tmpsadir, $f) ); Make that $f = Mail::SpamAssassin::Util::untaint_file_path ( File::Spec->catfile ($d, $f) # $d, not $tmpsadir! ); ...and everything is fine. Thanks for the prompt response. :-)
Created attachment 1674 [details] Updated patch Same patch as 1673, but fixed the issue as stated in the last comment.
moving to 2.62 again ...
+1 1674 :)
applied 1674 to 2.62 and head ... noticed another section of that function that needed changing. patch forthcoming.
Created attachment 1678 [details] need to change the error output section too ...
-1 1678: That's not necessary. This routine tries to remove $tmphome so that's what the error message complains about if it still exists. $tmpsadir is always below $tmphome, already covered by $tmphome. Checking for $err is also not necessary because $err can only be set if $tmphome still exists. OTOH if that dir exists and $err is *not* set, something really weird happened (== can't happen), that's why there's the "do something". $err will always contain the exact reason why $tmphome could not be removed.
Ok, good point, I missed that. :(