leonward / OpenFPC

OpenFPC, Open Source Full Packet Capture
http://www.openfpc.org
70 stars 10 forks source link

Perl Error: Unknown warnings category 'experimental::smartmatch' #1

Closed Mikej2007 closed 9 years ago

Mikej2007 commented 9 years ago

What steps will reproduce the problem?

  1. Install version /OpenFPC/tags/v0.9 from source on updated Debian Wheezy with perl 5, version 14, subversion 2 (v5.14.2) installed from apt-get
  2. Attempt to start openfpc or run "openfpc-dbmaint create session /etc/openfpc/openfpc-default.conf"
  3. Receive an error like:

[*] Restarting OpenFPC Node Default_Node Unknown warnings category 'experimental::smartmatch' at /usr/bin/openfpc line 31 BEGIN failed--compilation aborted at /usr/bin/openfpc line 31. Unknown warnings category 'experimental::smartmatch' at /usr/bin/openfpc line 31 BEGIN failed--compilation aborted at /usr/bin/openfpc line 31. root@pcap-wrm-01:/etc/openfpc# openfpc -a status -v Unknown warnings category 'experimental::smartmatch' at /usr/bin/openfpc line 31 BEGIN failed--compilation aborted at /usr/bin/openfpc line 31.

The reason this fails is the following:

http://blogs.perl.org/users/mike_b/2013/06/a-little-nicer-way-to-use-smartmatch-on-perl-518.html

Best resolution (if you were running dbmaint to create the session db) is to: Clean up the broken install first and replace a line in the file "openfpc"

First, clean up the broken install: -Remove OpenFPC by running: "./openfpc-install.sh remove" -From mysql, drop the ofpc_session_default database and drop the openfpc user:

As mysql root user do the following: drop database ofpc_session_default; use mysql; drop user 'openfpc'@'localhost';

Next, fix openfpc source file: In the source directory, edit openfpc: (something like:) nano ~/openfpc/github/OpenFPC/tags/v0.9/openfpc

-Remove or comment out the following line no warnings "experimental::smartmatch";

-Replace the removed line with the following: no if $] >= 5.017011, warnings => 'experimental::smartmatch';

Next, re-install openfpc, by running: "./openfpc-install.sh install"

Finally, run "openfpc-dbmaint create session /etc/openfpc/openfpc-default.conf" with great success.


Notes: If you don't want to remove the openfpc package to fix, you will have to fix the openfpc file in /usr/bin instead of at your source files directory. -So run "nano /usr/bin/openfpc" and make the same Perl edits as noted above.

Mikej2007 commented 9 years ago

Instead of removing the DB manually, you can use: openfpc-dbmaint drop session /etc/openfpc/openfpc-default.conf

I was afraid to use this feature, since in older versions of openfpc, this command removed root from the grants tables, locking me out of mysql. I tested this version and it correctly removed the openfpc DB without removing root from grants.

leonward commented 9 years ago

Thanks. Change made. Tested fine for me on my systems here. -L