]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Do not test unicode if boost::spirit >= 1.72 32388/head
authorWillem Jan Withagen <wjw@digiware.nl>
Sun, 22 Dec 2019 11:11:53 +0000 (12:11 +0100)
committerWillem Jan Withagen <wjw@digiware.nl>
Sun, 22 Dec 2019 15:08:10 +0000 (16:08 +0100)
Testing with Boost 1.72 unittest_confutil crashes with:
```
[ RUN      ] ConfUtils.ReadFiles2
Assertion failed: (strict_ischar(ch)), function isblank, file /usr/local/include/boost/spirit/home/support/char_encoding/standard.hpp, line 129.
Abort
```

Which is due to the fact that in Boost 1.72 most of the character
testing has been garded with an assert to make sure char holds an
ascii char.
Like:
```
        static bool
        isblank BOOST_PREVENT_MACRO_SUBSTITUTION (int ch)
        {
            BOOST_ASSERT(strict_ischar(ch));
            return (ch == ' ' || ch == '\t');
        }
```
And ReadFile2 explicitly tests for strings with char value > 0x7f.
So that is certainly going to crash.

Now I can imagine that we would like to be able to have users use
different encodings for things like logfiles.
But for now that is not going to work with the boost:spirit parser

Fixes: https://tracker.ceph.com/issues/43406
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/test/confutils.cc

index c9411b1827d00c3c34768a84c8237f49cef955eb..831e913351f21e39dc5b2f2e1913aacd69b8ce50 100644 (file)
@@ -231,6 +231,8 @@ const char illegal_conf4[] = "\
         keyring = osd_keyring          ; osd's keyring\n\
 ";
 
+#if BOOST_VERSION < 107200
+// Boost::spirit > 1.72 asserts on chars that are not < 0x7f
 // unicode config file
 const char unicode_config_1[] = "\
 [global]\n\
@@ -238,6 +240,7 @@ const char unicode_config_1[] = "\
         pid file =           foo-bar\n\
 [osd0]\n\
 ";
+#endif
 
 const char override_config_1[] = "\
 [global]\n\
@@ -363,12 +366,14 @@ TEST(ConfUtils, ReadFiles2) {
   ASSERT_EQ(cf1.read("global", "pid file", val), 0);
   ASSERT_EQ(val, "spork");
 
+#if BOOST_VERSION < 107200
   std::string unicode_config_1f(next_tempfile(unicode_config_1));
   ConfFile cf2;
   ASSERT_EQ(cf2.parse_file(unicode_config_1f.c_str(), &err), 0);
   ASSERT_EQ(err.tellp(), 0U);
   ASSERT_EQ(cf2.read("global", "log file", val), 0);
   ASSERT_EQ(val, "\x66\xd1\x86\xd1\x9d\xd3\xad\xd3\xae");
+#endif
 }
 
 TEST(ConfUtils, IllegalFiles) {