Skip to content
  • Thomas Haller's avatar
    core: fix match spec behavior for a list of all "except:" · a7ef23b3
    Thomas Haller authored
    If the spec specifies only negative matches (and none of them matches),
    then the result shall be positive.
    
    Meaning:
    
        [connection*] match-device=except:dhcp-plugin:dhclient
        [connection*] match-device=except:interface-name:eth0
        [.config] enabled=except:nm-version:1.14
    
    should be the same as:
    
        [connection*] match-device=*,except:dhcp-plugin:dhclient
        [connection*] match-device=*,except:interface-name:eth0
        [.config] enabled=*,except:nm-version:1.14
    
    and match by default. Previously, such specs would never yield a
    positive match, which seems wrong.
    
    Note that "except:" already has a special meaning. It is not merely
    "not:". That is because we don't support "and:" nor grouping, but all
    matches are combined by an implicit "or:". With such a meaning, having
    a "not:" would be unclear to define. Instead it is defined that any
    "except:" match always wins and makes the entire condition to explicitly
    not match. As such, it makes sense to treat a match that only consists
    of "except:" matches special.
    
    This is a change in behavior, but the alternative meaning makes
    little sense.
    a7ef23b3