Project

General

Profile

Actions

Bug #10757

closed

src/unittest_osd_osdcap fails on centos 6

Added by Loïc Dachary about 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
-
Target version:
-
% Done:

100%

Source:
other
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

As of 26cc9d347931949bab187953f0980b7ed7e8ad0b ( v0.92 )

Testing good input: '   allow
wx      pool
 taco   '
osdcap parse failed, stopped at '       allow
wx      pool
 taco   ' of '  allow
wx      pool
 taco   '
test/osd/osdcap.cc:81: Failure
Value of: cap.parse(str, &cout)
  Actual: false
Expected: true
[  FAILED  ] OSDCap.ParseGood (15 ms)

Actions #1

Updated by Samuel Just about 9 years ago

  • Priority changed from Normal to High
Actions #2

Updated by Kefu Chai about 9 years ago

  • Assignee set to Kefu Chai
Actions #3

Updated by Kefu Chai about 9 years ago

this is the OSD cap line which fails this test, please note the starting TAB.

"\tallow\nwx\tpool \n taco\t",

and we have following BNF for this sort of rule, defined by OSDCapParser:

grant := SP* "allow" (capspec match|match capspec) SP*
sep := SP* (";" | ",") SP*
grants := grant (sep grant)* 

and following method call is used to parse the grants line:

qi::phrase_parse(iter, end, g, ascii::space, *this)

where ascii::space is the skipper which is used to skip white spaces. but for ascii, TAB is indeed whitespace, per /usr/include/boost/spirit/home/support/char_encoding/ascii.hpp. but the interesting thing in boost 1.41/spirit v2.1, is that the skipper does not skip the beginning spaces. i changed the ascii.pp in boost to verify my guess:

--- /tmp/ascii.hpp      2015-02-11 21:58:43.561343634 +0800
+++ /usr/include/boost/spirit/home/support/char_encoding/ascii.hpp      2015-02-11 20:46:49.829164797 +0800
@@ -15,6 +15,7 @@
 #include <climits>
 #include <boost/assert.hpp>
 #include <boost/cstdint.hpp>
+#include <stdio.h>

 ///////////////////////////////////////////////////////////////////////////////
 // constants used to classify the single characters
@@ -253,6 +254,7 @@
         static int
         isspace(int ch)
         {
+             printf("===%c====", ch);
             BOOST_ASSERT(isascii_(ch));
             return (ascii_char_types[ch] & BOOST_CC_SPACE);
         }

following is the output of ./unittest_osd_osdcap --gtest_filter='OSDCap.ParseGood':

compiled with boost 1.55 on debian sid:

Running main() from gmock_main.cc
Note: Google Test filter = OSDCap.ParseGood
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from OSDCap
[ RUN      ] OSDCap.ParseGood
Testing good input: '   allow
wx      pool
 taco   '
===     =======a======= ====[       OK ] OSDCap.ParseGood (0 ms)
[----------] 1 test from OSDCap (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[  PASSED  ] 1 test.

compiled with boost 1.41 on centos 6.6

Running main() from gmock_main.cc
Note: Google Test filter = OSDCap.ParseGood
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from OSDCap
[ RUN      ] OSDCap.ParseGood
Testing good input: '   allow
wx      pool
 taco   '
osdcap parse failed, stopped at '       allow
wx      pool
 taco   ' of '  allow
wx      pool
 taco   '
test/osd/osdcap.cc:86: Failure
Value of: cap.parse(str, &cout)
  Actual: false
Expected: true
[  FAILED  ] OSDCap.ParseGood (0 ms)

i checked the changelog of spirit, but it doesn't mention the pre-skip of qi::phrase_parse.

Actions #4

Updated by Kefu Chai about 9 years ago

  • % Done changed from 0 to 80

PR posted at https://github.com/ceph/ceph/pull/3714, pending on review

Actions #5

Updated by Loïc Dachary about 9 years ago

  • Status changed from New to Resolved
  • % Done changed from 80 to 100
Actions

Also available in: Atom PDF