packetfence icon indicating copy to clipboard operation
packetfence copied to clipboard

Warning in CLI while loading modules

Open JeGoi opened this issue 8 months ago • 0 comments

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)
        [email protected]

root@IP:/usr/local/pf# 

Expected behavior Not see the warning

JeGoi avatar May 27 '24 19:05 JeGoi