You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by Henrik K <he...@hege.li> on 2022/05/10 04:21:36 UTC

Perlcritic for make test

A quick hack to run it without taint, created t/perlcritic.t which contains:

#!/usr/bin/perl
$ENV{'PATH'} = '/bin:/usr/bin';
-d "xt" && "$^X xt/60_perlcritic.t" =~ /(.*)/ ||
           "$^X ../xt/60_perlcritic.t" =~ /(.*)/;
exec($1);

Let me know if you think it can be committed.  I'll atleast leave it on my
local copy so it gets run..


On Tue, May 10, 2022 at 06:50:17AM +0300, Henrik K wrote:
> 
> Any objections on making perlcritic run by default with make test?
> 
> It's obviously useful and seems a waste to only run on release checks.
> 
> On Tue, May 10, 2022 at 06:41:40AM +0300, Henrik K wrote:
> > 
> > Duh.. embarassed for the bug. Good job perlcritic. :-D
> > 
> > On Tue, May 10, 2022 at 03:22:40AM -0000, sidney@apache.org wrote:
> > > Author: sidney
> > > Date: Tue May 10 03:22:40 2022
> > > New Revision: 1900770
> > > 
> > > URL: http://svn.apache.org/viewvc?rev=1900770&view=rev
> > > Log:
> > > make a map non-destructive fixes perlcritic error and makes it not destroy the list
> > > 
> > > Modified:
> > >     spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm
> > > 
> > > Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm
> > > URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm?rev=1900770&r1=1900769&r2=1900770&view=diff
> > > ==============================================================================
> > > --- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm (original)
> > > +++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm Tue May 10 03:22:40 2022
> > > @@ -443,7 +443,7 @@ sub _check_fromnamespoof {
> > >      foreach my $list (@lists) {
> > >        $list_refs->{$list} = $conf->{$list};
> > >      }
> > > -    dbg("using addrlists for owner aliases: ".join(', ', map { s/^FNS_//; $_ } @lists));
> > > +    dbg("using addrlists for owner aliases: ".join(', ', map { s/^FNS_//r; $_ } @lists));
> > >    }
> > >    my $fromname_owner = $self->_find_address_owner($fromname_addr, $fromname_domain, $list_refs);
> > >    my $from_owner = $self->_find_address_owner($from_addr, $from_domain, $list_refs);
> > > 

Re: Perlcritic for make test

Posted by Sidney Markowitz <si...@sidney.com>.
Henrik K wrote on 10/05/22 4:21 pm:
> 
> A quick hack to run it without taint, created t/perlcritic.t which contains:
> 
> #!/usr/bin/perl
> $ENV{'PATH'} = '/bin:/usr/bin';
> -d "xt" && "$^X xt/60_perlcritic.t" =~ /(.*)/ ||
>             "$^X ../xt/60_perlcritic.t" =~ /(.*)/;
> exec($1);

I submitted a bug report and a PR to Perl-Critic, but I see that their 
last commit was in October and they have 33 PRs languishing, so I'm not 
holding my breath.

I was about to say that setting PATH would break it when I use plenv or 
perlbrew to try out different perl versions, but then I noticed the $^X 
which does the job nicely.

Since everything is passing the perlcritic test and it runs so quickly, 
I'm +1 about adding it to the tests in t/. If we do that, we could 
remove the explicit invocation of it in xt/run_release_test_suite.sh 
because it will be part of t/*.t. If perl-critic ever fixes the bug we 
can then put the original test in t/ and get rid of the kludge to strip -T.

Re: Perlcritic for make test

Posted by Sidney Markowitz <si...@sidney.com>.
Henrik K wrote on 10/05/22 4:21 pm:
> 
> A quick hack to run it without taint, created t/perlcritic.t which contains:
> 
> #!/usr/bin/perl
> $ENV{'PATH'} = '/bin:/usr/bin';
> -d "xt" && "$^X xt/60_perlcritic.t" =~ /(.*)/ ||
>             "$^X ../xt/60_perlcritic.t" =~ /(.*)/;
> exec($1);

That happened to work with make disttest only because that runs in a 
subdirectory below trunk so ../xt found trunk/xt even though it isn't in 
MANIFEST. I committed a fix:

Author: sidney
Date: Tue May 10 23:23:31 2022
New Revision: 1900794

URL: http://svn.apache.org/viewvc?rev=1900794&view=rev
Log:
move percritic test code from xt directory which is not in MANIFEST

Added:
     spamassassin/trunk/t/perlcritic.pl   (with props)
Removed:
     spamassassin/trunk/xt/60_perlcritic.t
Modified:
     spamassassin/trunk/MANIFEST
     spamassassin/trunk/t/perlcritic.t

Modified: spamassassin/trunk/MANIFEST

    ...



Re: Perlcritic for make test

Posted by Bill Cole <sa...@billmail.scconsult.com>.
On 2022-05-10 at 00:21:36 UTC-0400 (Tue, 10 May 2022 07:21:36 +0300)
Henrik K <he...@hege.li>
is rumored to have said:

> A quick hack to run it without taint, created t/perlcritic.t which 
> contains:
>
> #!/usr/bin/perl
> $ENV{'PATH'} = '/bin:/usr/bin';
> -d "xt" && "$^X xt/60_perlcritic.t" =~ /(.*)/ ||
>            "$^X ../xt/60_perlcritic.t" =~ /(.*)/;
> exec($1);
>
> Let me know if you think it can be committed.

+1


-- 
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire