From 62a4019b2e00abcf5a5b989a96e6e0dd37911361 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 26 Mar 2019 18:11:58 +0800 Subject: [PATCH] ceph.in: only preload asan library if it is enabled 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 --- src/ceph.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ceph.in b/src/ceph.in index eea1f7809e19c..da5b891ce4ec0 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -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']]) -- 2.39.5