Git Product home page Git Product logo

noma's People

Contributors

mxhash avatar theflyingcorpse avatar thomas-gelf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

noma's Issues

Pattern matching dot treatment

I'm wondering that "vc*.kom" matches "vcvm.srv_kom" for a hostname rule. I looked into the source code and if I'm right this subroutine (in NoMa/notifier/lib/contacts.pm) is responsible for the observed behavior:
sub matchString { # test a string against a comma separated list and return 1 if it matches
my ($matchList, $match) =@_;

    my @items = split( ',', $matchList );
    @items = map( { lc($_) } @items );

    for my $item (@items)
    {
        # remove leading/trailing whitespace
        $item =~ s/^\s+|\s+$//g;

        if ( $item ne '' )
        {

    # Use * and ? as wildcards
            $item =~ s/\*/.*/g;
            $item =~ s/\./\./g;
            $item =~ s/\?/./g;

            # only add item to list if it matches the passed one
            return 1 if ( $match =~ m/^$item$/i );

        }

    }
return 0;

}

The treatment of "." in $item seems to be wrong, eventhough the dot will be correctly recognized, the replacement doesn't quote it right. $item still contains just a ".". The quoting expression should go like this:

$item =~ s/\./\\./g;
Could be verified by using following tests.
This matches, but should not:
perl -e '$p=".";$p=~s/\./\./g;$m="vc_kom";if($m =~ /$p/){print "$p matched $m\n"}'
Quoting it right, the dot really matches only literal dots:
perl -e '$p=".";$p=~s/\./\\./g;$m="vc_kom";if($m =~ /$p/){print "$p matched $m\n"}'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.