You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2008/04/06 21:56:45 UTC

[Bug 5875] New: MEMORY WASTE: eval in _get_cf_pre_files_in_dir needs to be quoted instead of {}ed as it brings in File ::Find anyways

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5875

           Summary: MEMORY WASTE: eval in _get_cf_pre_files_in_dir needs to
                    be quoted instead of {}ed as it brings in File::Find
                    anyways
           Product: Spamassassin
           Version: 3.2.4
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: spamassassin
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: nick@cpanel.net


sub _get_cf_pre_files_in_dir {
  my ($self, $dir, $type) = @_;


        Carp::cluck( "X: " . $self->{config_tree_recurse} . " : X");

  if ($self->{config_tree_recurse}) {
    my @cfs = ();

    # use "eval" to avoid loading File::Find unless this is specified
    eval '
      use File::Find qw();
      File::Find::find(
        sub {
          return unless (/\.${type}$/i && -f $_);
          push @cfs, $File::Find::name;
        }, $dir);
    ';
    return sort { $a cmp $b } @cfs;

    die "oops! $@";     # should never get here
  }
  else {
    opendir(SA_CF_DIR, $dir) or warn "config: cannot opendir $dir: $!\n";
    my @cfs = grep { /\.${type}$/i && -f "$dir/$_" } readdir(SA_CF_DIR);
    closedir SA_CF_DIR;

    return map { "$dir/$_" } sort { $a cmp $b } @cfs;
  }
}


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5875] MEMORY WASTE: eval in _get_cf_pre_files_in_dir needs to be quoted instead of {}ed as it brings in File ::Find anyways

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5875


Justin Mason <jm...@jmason.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Justin Mason <jm...@jmason.org>  2008-04-21 01:40:15 PST ---
applied to trunk, thanks!

svn commit -m "avoid loading File::Find unless explicitly required by
'config_tree_recurse', fix from J. Nick Koston" lib/Mail/SpamAssassin.pm
Sending        lib/Mail/SpamAssassin.pm
Transmitting file data .
Committed revision 650054.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5875] MEMORY WASTE: eval in _get_cf_pre_files_in_dir needs to be quoted instead of {}ed as it brings in File ::Find anyways

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5875


Justin Mason <jm...@jmason.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.3.0




--- Comment #1 from Justin Mason <jm...@jmason.org>  2008-04-07 11:28:45 PST ---
+1, looks good to me.  thanks for spotting it!


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.