]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: only preload asan library if it is enabled
authorKefu Chai <kchai@redhat.com>
Tue, 26 Mar 2019 10:11:58 +0000 (18:11 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 15 Nov 2019 15:02:02 +0000 (23:02 +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>
(cherry picked from commit 62a4019b2e00abcf5a5b989a96e6e0dd37911361)

src/ceph.in

index 51f844485c0a85c6ed6211226e49a0280f7d5d63..6ebeb4a988c05bb499a9e4ef1469563349d7a98f 100755 (executable)
@@ -111,8 +111,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
@@ -124,8 +125,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']])