solution: incorrect detection of logrotate version

OS: Gentoo Webmin version: 1.791 Virtualmin version: 5.05

Requisites: Initial setup of a virtualmin-compatible environment, including postfix, dovecot, apache, webalyzer, spamasassin, and so on, including the correct use flags.

Problem:

Running "Re-Check Configuration" presents the following output:

The status of your system is being checked to ensure that all enabled features are available, that the mail server is properly configured, and that quotas are active .. Your system has 3.86 GB of memory, which is at or above the Virtualmin recommended minimum of 256 MB. BIND DNS server is installed, and the system is configured to use it.

Mail server Postfix is installed and configured.

Postfix is configured to support per-domain outgoing IP addresses.

Apache is installed.

The following PHP versions are available : 5.6.25 (/usr/bin/php-cgi5.6), 7.0.10 (/usr/bin/php-cgi7.0)

Webalizer is installed.

MySQL is installed and running.

The Logrotate program appears to be version 3.10.0, but Virtualmin requires version 3.6 or above in order to support multiple log files in the same section.

.. your system is not ready for use by Virtualmin.

Clearly this is not intentional.

This is caused by a bug in the file /usr/share/webmin/virtual-server/virtual-server-lib-funcs.pl in the if statement:

if ($config{'logrotate'}) {

Where

local $ver = &logrotate::get_logrotate_version(); $ver >= 3.6 ||

is used to check the logrotate version. This is the incorrect way of doing so, and only works until 3.10, where 3.6 is compared to 3.1. The solution is to use version; in the top of the file, and then replace the above check with:

version->parse("v$ver") > version->parse("v3.6") ||

This will correctly validate versions. I also recommend using this method for checking other versions. NOTE: The 'versions' module is only built in to Perl 5.9 and above.

Status: 
Closed (fixed)

Comments

necrophcodr's picture
Submitted by necrophcodr on Fri, 09/09/2016 - 04:42

Status: Active » Needs review
necrophcodr's picture
Submitted by necrophcodr on Fri, 09/09/2016 - 04:48

Title: solution: » solution: incorrect detection of logrotate version

Jamie, just to reiterate what he mentioned above, the error in question is:

The Logrotate program appears to be version 3.10.0, but Virtualmin requires version 3.6 or above in order to support multiple log files in the same section.

And it appears that occurs due to the version check... Virtualmin thinks that 3.6 is higher than 3.10.0.

Ok, looks like we need to use Virtualmin's version comparison function that can deal with "numbers" like 3.10. This will be fixed in the next release.

Status: Needs review » Fixed