From: Simon McVittie Date: Wed, 24 Sep 2014 16:43:35 +0000 (+0100) Subject: Describe quoting for match rules X-Git-Tag: dbus-1.9.0~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=15f9e7bb7c658ab20fb217572e03b7d53faac894;p=thirdparty%2Fdbus.git Describe quoting for match rules I wish I could say "I can't believe this was never documented", but it wouldn't be true. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307 Reviewed-by: Alban Crequy --- diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index a110a083e..1830966f7 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -4558,6 +4558,32 @@ An example of a complete rule would be "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='Foo',path='/bar/foo',destination=':452345.34',arg2='bar'" + + Within single quotes (ASCII apostrophe, U+0027), a backslash + (U+005C) represents itself, and an apostrophe ends the quoted + section. Outside single quotes, \' (backslash, apostrophe) + represents an apostrophe, and any backslash not followed by + an apostrophe represents itself. For instance, the match rules + arg0=''\''',arg1='\',arg2=',',arg3='\\' and + arg0=\',arg1=\,arg2=',',arg3=\\ + both match messages where the arguments are a 1-character string + containing an apostrophe, a 1-character string containing a + backslash, a 1-character string containing a comma, and a + 2-character string containing two backslashes + + This idiosyncratic quoting style is based on the rules for + escaping items to appear inside single-quoted strings + in POSIX /bin/sh, but please + note that backslashes that are not inside single quotes have + different behaviour. This syntax does not offer any way to + represent an apostrophe inside single quotes (it is necessary + to leave the single-quoted section, backslash-escape the + apostrophe and re-enter single quotes), or to represent a + comma outside single quotes (it is necessary to wrap it in + a single-quoted section). + + . + The following table describes the keys that can be used to create a match rule.