http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4932

           Summary: userprefs_dir not created anymore / userprefs warning
                    incorrect
           Product: Spamassassin
           Version: 3.1.2
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Libraries
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


I was noticing that a previous change I made (r386260 per bug 4827) doesn't 
work right in M::SA::init(), 
but don't have time to directly fix it right now:

old:
      # user prefs file
      $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)) {
          warn "config: failed to create default user preference file $fname\n";
        }
      }

new:
      # user prefs file
      $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)) {
          warn "config: failed to create default user preference file $fname\n";
        }
      }
      else {
        warn "config: could not find userprefs file\n";
      }


the problem is that in the old code, $fname would always be defined as the last 
entry of 
@default_userprefs_path, so it would then get created if necessary.  In the new 
code, if the prefs don't 
exist, a warn is thrown and that's the end of it.  D'oh!   So if it doesn't 
already exist, we should look at 
$default_userprefs_path[-1], try to create it if necessary, etc.

I think the warn can just go away at that point since the 4 states (exists/use 
it, exists/don't use it, 
doesn't exist/use it, doesn't exist/don't use it) are covered already.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to