From: Kefu Chai Date: Thu, 12 Feb 2015 05:02:45 +0000 (+0800) Subject: osd: fix OSDCap parser on old boost/spirit X-Git-Tag: v0.93~47^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3714%2Fhead;p=ceph.git osd: fix OSDCap parser on old boost/spirit * on boost 1.41, the ascii::space skipper fails to skip the spaces at the beginning of the parsed string, so as a workaround we replace the `lit(' ')` in grammar spec with `ascii::blank`. this also simplifies the grammar a little bit. Fixes: #10757 Signed-off-by: Kefu Chai --- diff --git a/src/osd/OSDCap.cc b/src/osd/OSDCap.cc index 383674fd766..b9944e57e54 100644 --- a/src/osd/OSDCap.cc +++ b/src/osd/OSDCap.cc @@ -182,7 +182,7 @@ struct OSDCapParser : qi::grammar str %= quoted_string | unquoted_word; estr %= equoted_string | unquoted_word; - spaces = +(lit(' ') | lit('\n') | lit('\t')); + spaces = +ascii::space; // match := [pool[=] [namespace[=]] | auid <123>] [object_prefix ] @@ -214,12 +214,12 @@ struct OSDCapParser : qi::grammar str [_val = phoenix::construct(_1, string())] )); // grant := allow match capspec - grant = (*lit(' ') >> lit("allow") >> + grant = (*ascii::blank >> lit("allow") >> ((capspec >> match) [_val = phoenix::construct(_2, _1)] | (match >> capspec) [_val = phoenix::construct(_1, _2)]) >> - *lit(' ')); + *ascii::blank); // osdcap := grant [grant ...] - grants %= (grant % (*lit(' ') >> (lit(';') | lit(',')) >> *lit(' '))); + grants %= (grant % (lit(';') | lit(','))); osdcap = grants [_val = phoenix::construct(_1)]; } qi::rule spaces;