inverse-inc / packetfence

PacketFence is a fully supported, trusted, Free and Open Source network access control (NAC) solution. Boasting an impressive feature set including a captive-portal for registration and remediation, centralized wired and wireless management, powerful BYOD management options, 802.1X support, layer-2 isolation of problematic devices; PacketFence can be used to effectively secure networks small to very large heterogeneous networks.
https://packetfence.org
GNU General Public License v2.0
1.31k stars 278 forks source link

Warning in CLI while loading modules #8164

Closed JeGoi closed 2 months ago

JeGoi commented 4 months ago

Describe the bug

root@IP :/usr/local/pf# bin/pfcmd fingerbank
[...]
each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Document.pm line 75.
each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Provider.pm line 376.
each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Provider.pm line 875.
each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Provider.pm line 894.
[...]

These lines should not be there.

To Reproduce Steps to reproduce the behavior:

  1. install pf on debian12
  2. run command line with bin/pfcmd something with argument or submodule
  3. See error

So this is coming from: https://github.com/inverse-inc/packetfence/blob/feature/debian12/lib/pf/cmd/subcmd.pm#L48 which can be split in two steps:

use Data::Dumper;
        eval {
            if ( is_loaded($module)) {
print("\n"); # we do not care yet, no issue at this point
            } else {
print("\n");
print("nope b\n");
print Dumper ($module);
print("\n");
print("\n");
                load $module;
print("\n");
print("nope a\n");
print Dumper ($module);
print("\n");
print("\n");

            }
            $cmd = $module;
        };

As result:

root@IP :/usr/local/pf# bin/pfcmd fingerbank

nope b
$VAR1 = 'pf::cmd::pf::fingerbank';

each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Document.pm line 75.
each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Provider.pm line 376.
each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Provider.pm line 875.
each on anonymous hash will always start from the beginning at /usr/local/pf/lib_perl/lib/perl5/x86_64-linux-gnu-thread-multi/Template/Provider.pm line 894.

nope a
'pf::cmd::pf::fingerbank'

Usage:
     pfcmd fingerbank <command>

So, something is happening with load of the Module::Load: https://metacpan.org/pod/Module::Load https://metacpan.org/dist/Module-Load/source/lib/Module/Load.pm

We are using the latest version:

root@IP:/usr/local/pf# cpan -D Module::Load
Reading '/root/.cpan/Metadata'
  Database was generated on Mon, 27 May 2024 17:52:41 GMT
Module::Load
-------------------------------------------------------------------------
        (no description)
        B/BI/BINGOS/Module-Load-0.36.tar.gz
        /usr/share/perl/5.36/Module/Load.pm
        Installed: 0.36
        CPAN:      0.36  up to date
        Chris Williams (BINGOS)
        chris@bingosnet.co.uk

root@IP:/usr/local/pf# 

Expected behavior Not see the warning

jrouzierinverse commented 2 months ago

We need to upgrade the Template Toolkit module

jrouzierinverse commented 2 months ago

This was fixed by 118c451cfa1a7e74899283e3b9ba2cde6d12c8d4