RemoveMatch returns success even if the match rule didn't exist
Reported by Robert Middleton on the mailing list.
Steps to reproduce
dbus-monitor &
dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.RemoveMatch string:"type='signal'"
Expected result
Error named org.freedesktop.DBus.Error.MatchRuleNotFound
, with message The given match rule wasn't found and can't be removed
Actual result
The dbus-daemon sends a successful reply and an error reply
Cause
/* Send the ack before we remove the rule, since the ack is undone
* on transaction cancel, but rule removal isn't.
*/
if (!bus_driver_send_ack_reply (connection, transaction, message, error))
goto failed;
matchmaker = bus_connection_get_matchmaker (connection);
if (!bus_matchmaker_remove_rule_by_value (matchmaker, rule, error))
goto failed;
The "ack" (successful reply with no arguments) is attached to the transaction even if removing the match rule is going to fail, and is not removed from the transaction on failure (and in fact I don't think we have any way to achieve that).