Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#9 letter 'l' removed from --export option

closed
nobody
None
5
2010-11-10
2010-11-08
Chris Chalfant
No

All letter L's are removed from the --export option in 3.4.2. To replicate, create /usr/share/collectl/ltest.ph that just prints the contents of @_ to the log. Then edit /etc/collectl.conf and add this to the end of the DaemonCommands:

--export=ltest,blah1=lol,blah2=lol2

Then start collect as a daemon with /etc/init.d/collectl start and examine the log file. You will see something like this:

20101108 08:22:19 d-bah1=o bah2=o2

I've isolated the problem to the disableSubsys() subroutine in formatit.ph. I believe the substitution in line 1454 is too agressive (see below). When called, disableSubsys() will strip all instances of string $type from the @expOpts

# When a subsys is selected for which this is no possibility of collecting
# data, we must disable it in subsys as well as any --export modules which
# explicitly selects that subsys too
sub disableSubsys
{
my $type=shift;
my $why= shift;

# If user specified --all, they shouldn't see these messages
logmsg("W", "-s$type disabled because $why") if !$allFlag;
$subsys=~s/$type//ig;

# Not really sure if need to do this but it certainly can't hurt.
$EFlag=0 if $type=~/E/;
$bFlag=$BFlag=0 if $type=~/b/;
$lFlag=$KFlag=0 if $type=~/l/;
$xFlag=$XFlag=0 if $type=~/x/;

# Now make sure any occurances in s= of an export are disabled too.
for (my $i=0; $i<@expOpts; $i++)
{
if ($expOpts[$i]=~/$type/i)
{
logmsg('W', "found 's=$type' in lexpr so disabled there too") if !$allFlag;
$expOpts[$i]=~s/$type//ig; # <--- THIS IS THE CULPRIT
}
}
}

Discussion

  • Mark Seger
    Mark Seger
    2010-11-08

    excellent catch!!! And thank you for pointing me to the problem too..
    btw - and for what it's worth, I was able to replicate this is a much easier way:

    [root@poker collectl]# ./collectl.pl -slc --export lexpr.ph,s=cl,f=abcl
    -sl disabled because this system does not have lustre modules installed
    found 's=l' in lexpr so disabled there too
    found 's=l' in lexpr so disabled there too

    In fact I'm even reporting that I'm removing it from 2 of lexpr's switches.

    The problem was if you specified a subsystem that didn't exist, such as l, and you also specified it as part of 's=' in lexpr, I had to remove it there too. The bug, I think, is I should only remove those instances from the s= option and not all of them by changing:

    if ($expOpts[$i]=~/$type/i)

    to

    if ($expOpts[$i]=~/s=.*$type/i)

    [root@poker collectl]# ./collectl.pl -slc --export lexpr.ph,s=cl,f=abcl
    -sl disabled because this system does not have lustre modules installed
    found 's=l' in lexpr so disabled there too

    at least that seems to work. Give it a shot and let me know what you think.

    -mark

     
  • Mark Seger
    Mark Seger
    2010-11-10

    • status: open --> closed