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

            Bug ID: 7123
           Summary: Address some warnings issued by 'use re qw(strict)' in
                    perl 5.21.8
           Product: Spamassassin
           Version: 3.4 SVN branch
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Libraries
          Assignee: [email protected]
          Reporter: [email protected]

Perl 5.21.8 provides some additional warnings and checks,
which are disabled by default, but can potentially point out
a genuine bug.

The perldelta tells:

"use re 'strict'"
  This applies stricter syntax rules to regular expression patterns
  compiled within its scope, which hopefully will alert you to typos and
  other unintentional behavior that backwards-compatibility issues
  prevent us from doing in normal regular expression compilations.
  Because the behavior of this is subject to change in future Perl
  releases as we gain experience, using this pragma will raise a category
  "experimental:re_strict" warning.  See 'strict' in re.


So I have temporarily inserted (and then removed) the:

  use warnings 'extra';
  no warnings 'experimental::re_strict';
  use re 'strict';

and run 'make test' under perl 5.21.8.  It showed plenty of warnings,
most of them unnecessary, but few of them pointed to a real or
potential bug:

  Need exactly 3 octal digits in regex

  Use \x{...} for more than two hex characters in regex

  \0.." is more clearly written simply as "\." in regex

  Ranges of ASCII printables should be some subset of "0-9",
    "A-Z", or "a-z" in regex

For cases of unnecessary "Ranges of ASCII printables..." or the
"is more clearly written as" I have locally disabled the re strict
check (no re 'strict'), but as the re 'strict' is not recognized
by older versions of perl, these few lines are now commented out,
yet left in code as a reminder.

Found a genuine bug in PerMsgStatus.pm where a regexp specified a
too wide range or characters: [0-9a-fA-f] (instead of [0-9a-fA-F]).

Fixed the "Need exactly 3 octal digits in regex" for null characters
in Message/Metadata/Received.pm.

Added a missing 'use warnings' to plugins ASN and FreeMail,
and to sa-learn.raw, which were the only three files without
the 'use warnings'.

Avoided a potentially ambiguous \x followed by three hex digits
(a warning: "Use \x{...} for more than two hex characters in regex")
in Util.pm and in rules/25_replace.cf replace_tag A.

Adapted t/recreate.t to ignore unnecessary warnings due
to "Ranges of ASCII printables" in several rules.


Attached is a preliminary patch for inspection. I may need to
update some detail after all tests are completed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to