Comment 3 for bug 1392983

Revision history for this message
Allan Dyer (adyer) wrote :

The problem appears to be that the new version has added configuration data. The script zmupdate.pl is supposed to update the configuration in the mysql Config table, but it fails to compile because it depends on a new configuration value, ZM_DYN_DB_VERSION, which has not been created yet.
I found a file /undef.log containing the error:
---
12/29/14 20:39:24.043538 undef[1400].ERR-zm_config.cpp/259 [Config mismatch, expected 215 items, read 202. Try running 'zmupdate.pl -f' to reload config.]
Attempting to run zmupdate.pl -f gives:
Bareword "ZM_DYN_DB_VERSION" not allowed while "strict subs" in use at /usr/bin/zmupdate.pl line 111.
BEGIN not safe after errors--compilation aborted at /usr/bin/zmupdate.pl line 149.
---
It seems there are some other new configuration values.
Workaround:
Use a script to update the Config stored in the database:
---
#!/usr/bin/perl -w
#
# Fix the ZoneMinder configuration table with data from ZoneMinder:ConfigData package

use strict;
use bytes;

use ZoneMinder::ConfigAdmin qw(:all);
loadConfigFromDB();
saveConfigToDB();
exit;
---
Running the script gave:
---
./zmfix.pl
Loading config from DB
No option 'ZM_LOCAL_BGR_INVERT' found, removing at /usr/share/perl5/ZoneMinder/ConfigAdmin.pm line 89.
No option 'ZM_Y_IMAGE_DELTAS' found, removing at /usr/share/perl5/ZoneMinder/ConfigAdmin.pm line 89.
No option 'ZM_BLEND_ALARMED_IMAGES' found, removing at /usr/share/perl5/ZoneMinder/ConfigAdmin.pm line 89.
No option 'ZM_V4L2_CAPTURE_FIELDS' found, removing at /usr/share/perl5/ZoneMinder/ConfigAdmin.pm line 89.
Saving config to DB
---
Checking the database, there are now 215 rows in Config.
Trying the update script again:
---
zmupdate.pl -f

Freshening configuration in database
Loading config from DB
Saving config to DB

Previous versions of ZoneMinder used the MyISAM database engine.
However, the recommended database engine is InnoDB.

Hint: InnoDB tables are much less likely to be corrupted during an unclean shutdown.

Press 'y' to convert your tables to InnoDB or 'n' to skip : y

Converting MyISAM tables to InnoDB. Please wait.
---
The conversion has not finished yet, so I cannot confirm that this workaround works, but it does allow zmupdate.pl to run.
A proper fix would modify zmupdate.pl so that it is not dependant on configuration values that do not exist in old versions.