]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: only preload asan library if it is enabled 27190/head
authorKefu Chai <kchai@redhat.com>
Tue, 26 Mar 2019 10:11:58 +0000 (18:11 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 27 Mar 2019 01:55:43 +0000 (09:55 +0800)
my ceph cli hung when i build ceph using `CMAKE_BUILD_TYPE=RelWithDebInfo` and
`WITH_SEASTAR=ON`. because in that case, seastar detects for Sanitize flags
support of the compiler, but it does not pull in the build flags to enable
sanitizers. while `ceph` cli still preloaded the `asan_lib_path` because
`ASAN_LIBRARY` was set. this is not right, as we should enable ASAN at
runtime only if we enable it at compile-time.

so, in this change, we preload the ASAN library when `CMAKE_BUILD_TYPE`
is `Debug` and `WITH_SEASTAR=ON`, or `WITH_ASAN=ON`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph.in

index eea1f7809e19c505163209680b00bbef7cf7af81..da5b891ce4ec0a987f840dc7cffc6f9bcb5e70ac 100755 (executable)
@@ -115,8 +115,9 @@ def get_cmake_variables(*names):
 
 if os.path.exists(os.path.join(MYPDIR, "CMakeCache.txt")) \
      and os.path.exists(os.path.join(MYPDIR, "bin/init-ceph")):
-    src_path, asan_lib_path = \
-        get_cmake_variables("ceph_SOURCE_DIR", "ASAN_LIBRARY")
+    src_path, build_type, with_seastar, with_asan, asan_lib_path = \
+        get_cmake_variables("ceph_SOURCE_DIR", "CMAKE_BUILD_TYPE",
+                            "WITH_SEASTAR", "WITH_ASAN", "ASAN_LIBRARY")
     if src_path is None:
         # Huh, maybe we're not really in a cmake environment?
         pass
@@ -128,8 +129,10 @@ if os.path.exists(os.path.join(MYPDIR, "CMakeCache.txt")) \
         pythonlib_path = os.path.join(lib_path,
                                       "cython_modules",
                                       get_pythonlib_dir())
-
-        respawn_in_path(lib_path, pybind_path, pythonlib_path, asan_lib_path)
+        if with_seastar and build_type == 'Debug':
+            with_asan = True
+        respawn_in_path(lib_path, pybind_path, pythonlib_path,
+                        asan_lib_path if with_asan else None)
 
         if 'PATH' in os.environ and bin_path not in os.environ['PATH']:
             os.environ['PATH'] = os.pathsep.join([bin_path, os.environ['PATH']])