Bug#1026905: Use of uninitialized value $ver in PPIx::Regexp::Structure::Assertion

Russ Allbery rra at debian.org
Fri Dec 23 17:15:56 GMT 2022


Package: libppix-regexp-perl
Version: 0.086-1
Severity: minor
X-Debbugs-Cc: rra at debian.org

Starting I believe with 0.086, the following test program:

use 5.010;
use strict;
use warnings;
use Test::MinimumVersion;

all_minimum_version_ok('5.010');

produces warning messages for modules using complex regexes:

Use of uninitialized value $ver in numeric lt (<) at /usr/share/perl5/PPIx/Regexp/Structure/Assertion.pm line 82.
ok 2 - lib/Pod/Text.pm
Use of uninitialized value $ver in numeric lt (<) at /usr/share/perl5/PPIx/Regexp/Structure/Assertion.pm line 82.
ok 3 - lib/Pod/Man.pm

I think this is a bug in PPIx::Regexp::Structure::Assertion.  The code at
that line is:

sub _perl_version_introduced {
    my ( $self ) = @_;
    my $ver = max( map { $_->perl_version_introduced() }
        $self->children() );
    if ( $ver < VARIABLE_LENGTH_LOOK_BEHIND_INTRODUCED &&
        !  $self->is_look_ahead()
    ) {
        my ( $wid_min, $wid_max ) = $self->raw_width();
        defined $wid_min
            and defined $wid_max
            and $wid_min < $wid_max
            and $ver = max( $ver, VARIABLE_LENGTH_LOOK_BEHIND_INTRODUCED );
    }
    return $ver;
}

The base case of this recursion with no children looks like it's going to
call max on the empty list, which returns undef, which I think is the
cause of those warnings, although I'm not 100% sure.

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'unstable-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.0.0-6-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libppix-regexp-perl depends on:
ii  libppi-perl          1.276-1
ii  libtask-weaken-perl  1.06-2
ii  perl                 5.36.0-6

libppix-regexp-perl recommends no packages.

libppix-regexp-perl suggests no packages.

-- no debconf information



More information about the pkg-perl-maintainers mailing list