[pulseaudio-discuss] RFC: Change the modarg parser to keep the raw form

Colin Guthrie gmane at colin.guthr.ie
Tue Sep 6 04:10:26 PDT 2011


'Twas brillig, and Colin Guthrie at 06/09/11 11:53 did gyre and gimble:
> Late in the cycle so wanted to get more eyes on this before pushing.
> 
> These patches simply modify things to ensure that the 'raw' form of
> modargs will still be accessable and thus can be used by the proplist
> parser.
> 
> Now, this does break the proplist-test as it no longer parses the triple
> escaped input. IMO, this is acceptable, as there should be no need to triple
> escape things due to a quirk of how the modargs are parsed in the first place.
> 
> That said, compatibility may be more important here? I suspect the impact of
> a change would be minimal however.

Just for the sake of completeness, this does have some drawbacks.

Under the old scheme, you could vary which type of quotes you used for
your property assignments in the proplist itself. (i.e. mix and match
double quotes, vs single quotes: foo="bar" foo2='wibble'

With this new "improved" scheme, we have to use the same style quotes
all the way through - i.e. the opposite type to what we delimit the
argument itself with:

e.g.
 sink_properties="foo='bar\"quote\"' foo2='wibble'"
or
 sink_properties='foo="bar\"quote\"" foo2="wibble"'

both work fine, but you can't mix and match.

IMO, even with this limitation, it is still simpler than passing:
 sink_properties="foo='bar\\\"quote\\\"' foo2='wibble'"
or
 sink_properties='foo="bar\\\"quote\\\"" foo2="wibble"'



For reference, this is the change needed to "fix" the test:

diff --git a/src/tests/proplist-test.c b/src/tests/proplist-test.c
index 27a0d3f..8b5a235 100644
--- a/src/tests/proplist-test.c
+++ b/src/tests/proplist-test.c
@@ -81,7 +81,7 @@ int main(int argc, char*argv[]) {
     printf("%s\n", v);
     pa_xfree(v);

-    pa_assert_se(ma = pa_modargs_new("foo='foobar=waldo
foo2=\"lj\\\\\"dhflh\" foo3=\\'kjlskj\\\\\\'\\''", x));
+    pa_assert_se(ma = pa_modargs_new("foo='foobar=waldo
foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x));
     pa_assert_se(a = pa_proplist_new());

     pa_assert_se(pa_modargs_get_proplist(ma, "foo", a,
PA_UPDATE_REPLACE) >= 0);






-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the pulseaudio-discuss mailing list