https://bugzilla.redhat.com/show_bug.cgi?id=838656 (Red Hat Enterprise Linux 7)
Description of problem: Running logconv.pl tool with -m or -M option without specifying the stats.out file, leads to removal of the access logs file contents. This option is recently introduced to generate Minute/Second based statitics for the ldap operations. Version-Release number of selected component (if applicable): 389-ds-base-1.2.10.2-20 How reproducible: Consistently Steps to Reproduce: 1. Install 389-ds-base latest packages on rhel6. 2. Run logconv.pl tool with -M option. First, run "ls -l /var/log/dirsrv/slapd-inst/access" to check the size of the file. /usr/bin/logconv.pl -M /var/log/dirsrv/slapd-inst/access > /tmp/logconv.out It generates output as - Illegal division by zero at /usr/bin/logconv.pl line 517 Also, it removes the contents of access logs. Check the file size now. Actual results: Improper usages of command leads to removal of file contents. Expected results: Improper usage should give an error message and it should print the help. Additional info: Correct usage of the command. logcov.pl -M /tmp/min_stats.out /var/log/dirsrv/slapd-inst/access
A minor question...
0 is assigned to $fc (note: not "0") and the variable is used for the array index. So, the if expression at the line would be ($fc == 0)? {{{ 64 $fc = 0; [...] 134 135 136 if($fc eq "0"){ <===??? 137 if($report_opt ne ""){ }}}
Replying to [comment:4 nhosoi]:
A minor question... 0 is assigned to $fc (note: not "0") and the variable is used for the array index. So, the if expression at the line would be ($fc == 0)? {{{ 64 $fc = 0; [...] 134 135 136 if($fc eq "0"){ <===??? 137 if($report_opt ne ""){ }}}
In this case, Perl interprets it the same way, 0 or "0". But I will change it. New patch is being attached.
revision 0001-Ticket-471-logconv.pl-tool-removes-the-access-logs-c.patch
git merge ticket471 Updating 0c44a46..89fb342 Fast-forward ldap/admin/src/logconv.pl | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
[mareynol@localhost ds]$ git push origin master Counting objects: 11, done. Delta compression using up to 4 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (6/6), 893 bytes, done. Total 6 (delta 4), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git 0c44a46..89fb342 master -> master
Ticket has been cloned to Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1013135
To ssh://git.fedorahosted.org/git/389/ds.git fbece32..313dd8e 389-ds-base-1.2.11 -> 389-ds-base-1.2.11 commit 96cdf89 Author: Mark Reynolds mreynolds@redhat.com Date: Tue Jan 8 13:47:25 2013 -0500
To ssh://git.fedorahosted.org/git/389/ds.git c96eaa0..9103b3e 389-ds-base-1.3.0 -> 389-ds-base-1.3.0 commit 9f0c939 Author: Mark Reynolds mreynolds@redhat.com Date: Tue Jan 8 13:47:25 2013 -0500
The fix does not remove the access log, the file is still there, but it is 0 length.
I think the problem is that, no matter what, the function new_stats_block() is called: {{{ 'm|reportFileSecs=s' => sub { my ($opt,$value) = @; $s_stats = new_stats_block($value); $reportStats = "-m";}, 'M|reportFileMins=s' => sub { my ($opt,$value) = @; $m_stats = new_stats_block($value); $reportStats = "-M";}, }}}
Which does this: {{{ sub new_stats_block { my $name = shift || ''; my $stats = { 'active' => 0, }; if ($name){ $stats = openHashFiles($dataLocation, @statnames); $stats->{'filename'} = $name; $stats->{'fh'} = new IO::File; $stats->{'active'} = open($stats->{'fh'},">$name"); } reset_stats_block( $stats );
return $stats;
} }}} The problem is that open($stats->{'fh'},">$name") will open the file for writing, and will truncate it to 0.
additional 0001-Ticket-471-logconv.pl-tool-removes-the-access-logs-c.patch 0001-Ticket-471-logconv.pl-tool-removes-the-access-logs-c.2.patch
To ssh://git.fedorahosted.org/git/389/ds.git abe5c89..fd065f1 389-ds-base-1.2.11 -> 389-ds-base-1.2.11 commit fd065f1 Author: Rich Megginson rmeggins@redhat.com Date: Fri Jan 31 16:49:58 2014 -0700 9ebe2e8..af85853 389-ds-base-1.3.0 -> 389-ds-base-1.3.0 commit af85853d0a9bf429a365a2c1723ac0758046899a Author: Rich Megginson rmeggins@redhat.com Date: Fri Jan 31 16:49:58 2014 -0700 ea86856..811300f 389-ds-base-1.3.1 -> 389-ds-base-1.3.1 commit 811300f Author: Rich Megginson rmeggins@redhat.com Date: Fri Jan 31 16:49:58 2014 -0700 55df132..cfbda42 389-ds-base-1.3.2 -> 389-ds-base-1.3.2 commit cfbda42 Author: Rich Megginson rmeggins@redhat.com Date: Fri Jan 31 16:49:58 2014 -0700 f9ba01b..7447050 master -> master commit 7447050 Author: Rich Megginson rmeggins@redhat.com Date: Fri Jan 31 16:49:58 2014 -0700
Metadata Update from @rmeggins: - Issue assigned to rmeggins - Issue set to the milestone: 1.3.1
389-ds-base is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in 389-ds-base's github repository.
This issue has been cloned to Github and is available here: - https://github.com/389ds/389-ds-base/issues/471
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.
Metadata Update from @spichugi: - Issue close_status updated to: wontfix (was: Fixed)
Login to comment on this ticket.