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 2019/09/01 00:25:03 UTC

Re: "use POSIX" in ruleqa?

On Sat, Aug 31, 2019 at 12:08:31PM -0700, John Hardin wrote:
> All:
> 
> I'd like to add "use POSIX" to some code used in ruleqa - anybody know
> whether that would break ruleqa because that module isn't installed?

It's core module, so it's not possible to be missing.  What are you
planning?


Re: "use POSIX" in ruleqa?

Posted by Henrik K <he...@hege.li>.
On Sun, Sep 01, 2019 at 03:12:51PM -0700, John Hardin wrote:
> On Sun, 1 Sep 2019, Henrik K wrote:
> 
> >On Sun, Sep 01, 2019 at 09:36:55AM -0700, John Hardin wrote:
> >>On Sun, 1 Sep 2019, Henrik K wrote:
> >>
> >>>On Sat, Aug 31, 2019 at 12:08:31PM -0700, John Hardin wrote:
> >>>>All:
> >>>>
> >>>>I'd like to add "use POSIX" to some code used in ruleqa - anybody know
> >>>>whether that would break ruleqa because that module isn't installed?
> >>>
> >>>It's core module, so it's not possible to be missing.
> >>
> >>Thanks. I did a quick search but didn't find any definitive information on
> >>that detail, and I'm too distant from day-to-day Perl programming anymore to
> >>remember that offhand.
> >>
> >>>What are you planning?
> >>
> >>The overlap percentages are calculated using int(), so they truncate - an
> >>overlap of 0.999% is reported as "no overlap". I'd prefer to replace that
> >>with a ceil() so that 0.001% - 0.999% is reported as 1% overlap instead.
> >>
> >>I'd be open to Math::Round() as well.
> >>
> >>It shouldn't affect score generation but would potentially make combination
> >>analysis for FP tuning a little better.
> >
> >Shouldn't need any module, just something like
> >
> >my $ceil = int($num + 0.9999);
> 
> I'd rather not roll my own if a standard library module function is
> available.

Well first of all, that pretty much _is_ the ceil function.  There's nothing
"own" to roll.  It's a simple calculation, so why would you not use it?

Second of all:

https://perldoc.perl.org/POSIX.html "Everything is exported by default (with
a handful of exceptions).  This is an unfortunate backwards compatibility
feature and its use is strongly discouraged."

Something like "use POSIX qw(:math_h)" would much much more approriate
instead of "use POSIX", if you still insist using the module.


Re: "use POSIX" in ruleqa?

Posted by John Hardin <jh...@impsec.org>.
On Sun, 1 Sep 2019, John Hardin wrote:

> On Sun, 1 Sep 2019, Henrik K wrote:
>
>> On Sun, Sep 01, 2019 at 09:36:55AM -0700, John Hardin wrote:
>>> On Sun, 1 Sep 2019, Henrik K wrote:
>>> 
>>>> On Sat, Aug 31, 2019 at 12:08:31PM -0700, John Hardin wrote:
>>>>> All:
>>>>> 
>>>>> I'd like to add "use POSIX" to some code used in ruleqa - anybody know
>>>>> whether that would break ruleqa because that module isn't installed?
>>>> 
>>>> It's core module, so it's not possible to be missing.
>>> 
>>> Thanks. I did a quick search but didn't find any definitive information on
>>> that detail, and I'm too distant from day-to-day Perl programming anymore 
>>> to
>>> remember that offhand.
>>> 
>>>> What are you planning?
>>> 
>>> The overlap percentages are calculated using int(), so they truncate - an
>>> overlap of 0.999% is reported as "no overlap". I'd prefer to replace that
>>> with a ceil() so that 0.001% - 0.999% is reported as 1% overlap instead.
>>> 
>>> I'd be open to Math::Round() as well.
>>> 
>>> It shouldn't affect score generation but would potentially make 
>>> combination
>>> analysis for FP tuning a little better.
>> 
>> Shouldn't need any module, just something like
>> 
>> my $ceil = int($num + 0.9999);
>
> I'd rather not roll my own if a standard library module function is 
> available.

OK, change checked in. I'll keep an eye on it and if something blows up 
I'll revert it.

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Are you a mildly tech-literate politico horrified by the level of
   ignorance demonstrated by lawmakers gearing up to regulate online
   technology they don't even begin to grasp? Cool. Now you have a
   tiny glimpse into a day in the life of a gun owner.   -- Sean Davis
-----------------------------------------------------------------------
  885 days since the first commercial re-flight of an orbital booster (SpaceX)

Re: "use POSIX" in ruleqa?

Posted by John Hardin <jh...@impsec.org>.
On Sun, 1 Sep 2019, Henrik K wrote:

> On Sun, Sep 01, 2019 at 09:36:55AM -0700, John Hardin wrote:
>> On Sun, 1 Sep 2019, Henrik K wrote:
>>
>>> On Sat, Aug 31, 2019 at 12:08:31PM -0700, John Hardin wrote:
>>>> All:
>>>>
>>>> I'd like to add "use POSIX" to some code used in ruleqa - anybody know
>>>> whether that would break ruleqa because that module isn't installed?
>>>
>>> It's core module, so it's not possible to be missing.
>>
>> Thanks. I did a quick search but didn't find any definitive information on
>> that detail, and I'm too distant from day-to-day Perl programming anymore to
>> remember that offhand.
>>
>>> What are you planning?
>>
>> The overlap percentages are calculated using int(), so they truncate - an
>> overlap of 0.999% is reported as "no overlap". I'd prefer to replace that
>> with a ceil() so that 0.001% - 0.999% is reported as 1% overlap instead.
>>
>> I'd be open to Math::Round() as well.
>>
>> It shouldn't affect score generation but would potentially make combination
>> analysis for FP tuning a little better.
>
> Shouldn't need any module, just something like
>
> my $ceil = int($num + 0.9999);

I'd rather not roll my own if a standard library module function is 
available.

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Are you a mildly tech-literate politico horrified by the level of
   ignorance demonstrated by lawmakers gearing up to regulate online
   technology they don't even begin to grasp? Cool. Now you have a
   tiny glimpse into a day in the life of a gun owner.   -- Sean Davis
-----------------------------------------------------------------------
  885 days since the first commercial re-flight of an orbital booster (SpaceX)

Re: "use POSIX" in ruleqa?

Posted by Henrik K <he...@hege.li>.
On Sun, Sep 01, 2019 at 09:36:55AM -0700, John Hardin wrote:
> On Sun, 1 Sep 2019, Henrik K wrote:
> 
> >On Sat, Aug 31, 2019 at 12:08:31PM -0700, John Hardin wrote:
> >>All:
> >>
> >>I'd like to add "use POSIX" to some code used in ruleqa - anybody know
> >>whether that would break ruleqa because that module isn't installed?
> >
> >It's core module, so it's not possible to be missing.
> 
> Thanks. I did a quick search but didn't find any definitive information on
> that detail, and I'm too distant from day-to-day Perl programming anymore to
> remember that offhand.
> 
> >What are you planning?
> 
> The overlap percentages are calculated using int(), so they truncate - an
> overlap of 0.999% is reported as "no overlap". I'd prefer to replace that
> with a ceil() so that 0.001% - 0.999% is reported as 1% overlap instead.
> 
> I'd be open to Math::Round() as well.
> 
> It shouldn't affect score generation but would potentially make combination
> analysis for FP tuning a little better.

Shouldn't need any module, just something like

my $ceil = int($num + 0.9999);


Re: "use POSIX" in ruleqa?

Posted by John Hardin <jh...@impsec.org>.
On Sun, 1 Sep 2019, Henrik K wrote:

> On Sat, Aug 31, 2019 at 12:08:31PM -0700, John Hardin wrote:
>> All:
>>
>> I'd like to add "use POSIX" to some code used in ruleqa - anybody know
>> whether that would break ruleqa because that module isn't installed?
>
> It's core module, so it's not possible to be missing.

Thanks. I did a quick search but didn't find any definitive information on 
that detail, and I'm too distant from day-to-day Perl programming anymore 
to remember that offhand.

> What are you planning?

The overlap percentages are calculated using int(), so they truncate - an 
overlap of 0.999% is reported as "no overlap". I'd prefer to replace that 
with a ceil() so that 0.001% - 0.999% is reported as 1% overlap instead.

I'd be open to Math::Round() as well.

It shouldn't affect score generation but would potentially make 
combination analysis for FP tuning a little better.


-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Are you a mildly tech-literate politico horrified by the level of
   ignorance demonstrated by lawmakers gearing up to regulate online
   technology they don't even begin to grasp? Cool. Now you have a
   tiny glimpse into a day in the life of a gun owner.   -- Sean Davis
-----------------------------------------------------------------------
  885 days since the first commercial re-flight of an orbital booster (SpaceX)