https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8050
Sidney Markowitz <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #5828|0 |1 is obsolete| | --- Comment #27 from Sidney Markowitz <[email protected]> --- Created attachment 5830 --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5830&action=edit Patch v3 Henrik, what do you think of this? What I changed from v2: Re-enabled the home_dir_for_helper code in Windows In Windows use Win32::GetFolderPath(Win32::CSIDL_COMMON_APPDATA()) instead of portable_getpwuid (which doesn't seem portable enough) Note: I didn't require a require or use statement because Win32 module ia core in Windows perl and doesn't exist elsewhere. Note 2: I'm back to being ok with using home_dor_for_helper if it exists, because it comes from an argument in the spamd command line. The person running spamd can set it to whatever they really want, so by definition it is ok to use if it exists. If it doesn't exist the block of code doesn't do anything. Like you did, here is the entire sub for easy viewing sub set_global_state_dir { my ($self) = @_; # try home_dir_for_helpers my $helper_dir = $self->{home_dir_for_helpers} || ''; if ($helper_dir) { my $dir = File::Spec->catdir($helper_dir, ".spamassassin"); return if $self->test_global_state_dir($dir); } # try user home (if different from helper home) my $home; if (am_running_on_windows()) { # Windows has a special folder for common appdata (Bug 8050) $home = Win32::GetFolderPath(Win32::CSIDL_COMMON_APPDATA()); } else { $home = (Mail::SpamAssassin::Util::portable_getpwuid ($>))[7]; } if ($home && $home ne $helper_dir) { my $dir = File::Spec->catdir($home, ".spamassassin"); return if $self->test_global_state_dir($dir); } # try LOCAL_STATE_DIR return if $self->test_global_state_dir($self->{LOCAL_STATE_DIR}); # fallback to userstate $self->{global_state_dir} = $self->get_and_create_userstate_dir(); dbg("config: global_state_dir set to userstate_dir: $self->{global_state_dir}"); } -- You are receiving this mail because: You are the assignee for the bug.
