You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2006/06/01 16:35:37 UTC
svn commit: r410869 - /spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm
Author: felicity
Date: Thu Jun 1 07:35:36 2006
New Revision: 410869
URL: http://svn.apache.org/viewvc?rev=410869&view=rev
Log:
bug 4932: continuing issues with bug 4827 fix -- make sure that the userstate dir is always created, let the userprefs file get created as necessary
Modified:
spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm
Modified: spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm?rev=410869&r1=410868&r2=410869&view=diff
==============================================================================
--- spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm Thu Jun 1 07:35:36 2006
@@ -1353,14 +1353,15 @@
$fname = $self->{userprefs_filename};
$fname ||= $self->first_existing_path (@default_userprefs_path);
- if (defined $fname) {
- if (!-f $fname && !$self->{dont_copy_prefs} && !$self->create_default_prefs($fname)) {
+ if (!$self->{dont_copy_prefs}) {
+ # bug 4932: if the userprefs path doesn't exist, we need to make it, so
+ # just use the last entry in the array as the default path.
+ $fname ||= $self->sed_path($default_userprefs_path[-1]);
+
+ if (!-f $fname && !$self->create_default_prefs($fname)) {
warn "config: failed to create default user preference file $fname\n";
}
}
- else {
- warn "config: could not find userprefs file\n";
- }
$self->{config_text} .= $self->read_cf ($fname, 'user prefs file');
}
@@ -1472,18 +1473,19 @@
$fname ||= $self->first_existing_path (@default_userstate_dir);
- if (defined $fname) {
- if (!$self->{dont_copy_prefs}) {
- dbg("config: using \"$fname\" for user state dir");
- }
-
- if (!-d $fname) {
- # not being able to create the *dir* is not worth a warning at all times
- eval { mkpath($fname, 0, 0700) } or dbg("config: mkdir $fname failed: $@ $!\n");
- }
+ # bug 4932: use the last default_userstate_dir entry if none of the others
+ # already exist
+ $fname ||= $self->sed_path($default_userstate_dir[-1]);
+
+ if (!$self->{dont_copy_prefs}) {
+ dbg("config: using \"$fname\" for user state dir");
}
- else {
- info("config: can not determine userstate dir\n");
+
+ # bug 4932: we always want to make the userstate directory, even if
+ # dont_copy_prefs is true for things like bayes, awl, etc.
+ if (!-d $fname) {
+ # not being able to create the *dir* is not worth a warning at all times
+ eval { mkpath($fname, 0, 0700) } or dbg("config: mkdir $fname failed: $@ $!\n");
}
$fname;