https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8050

Henrik Krohns <apa...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5825|0                           |1
        is obsolete|                            |

--- Comment #11 from Henrik Krohns <apa...@hege.li> ---
Created attachment 5828
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5828&action=edit
Patch v2

Thanks, understood the $prev bug atleast..

The home_dir_for_helpers stuff seems quite convoluted.. spamd implies that -H
alone with any argument users spamc user home? Not sure how that's supposed to
work looking at the code, home_dir_for_helpers is only used in
Dns::enter_helper_run_mode and considers empty value. Pfft, too much work to
try to get into this all..

How about this new patch. I really don't have time to figure out things more so
I trust your judgement about ignoring helpers. I cleaned it up to use
test_global_state_dir() return value too, maybe a bit simpler logic.

Whole sub for easier read:

sub set_global_state_dir {
  my ($self) = @_;
  # skip checking helper and user home on Windows (Bug 8050)
  if (!am_running_on_windows()) {
    # 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 = (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.

Reply via email to