From f316c8b797283818bd800569771870a4b9bf1310 Mon Sep 17 00:00:00 2001 From: Sunny Kumar Date: Fri, 12 Apr 2019 19:55:10 +0530 Subject: libgfchangelog : use find_library to locate shared library Issue: libgfchangelog.so: cannot open shared object file Due to hardcoded shared library name runtime loader looks for particular version of a shared library. Solution: Using find_library to locate shared library at runtime solves this issue. Traceback (most recent call last): File "/usr/libexec/glusterfs/python/syncdaemon/gsyncd.py", line 323, in main func(args) File "/usr/libexec/glusterfs/python/syncdaemon/subcmds.py", line 82, in subcmd_worker local.service_loop(remote) File "/usr/libexec/glusterfs/python/syncdaemon/resource.py", line 1261, in service_loop changelog_agent.init() File "/usr/libexec/glusterfs/python/syncdaemon/repce.py", line 233, in __call__ return self.ins(self.meth, *a) File "/usr/libexec/glusterfs/python/syncdaemon/repce.py", line 215, in __call__ raise res OSError: libgfchangelog.so: cannot open shared object file: No such file or directory Change-Id: I3dd013d701ed1cd99ba7ef20d1898f343e1db8f5 fixes: bz#1699394 Signed-off-by: Sunny Kumar --- tools/glusterfind/src/libgfchangelog.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/glusterfind/src/libgfchangelog.py b/tools/glusterfind/src/libgfchangelog.py index 1ef177ab2a5..513bb101e93 100644 --- a/tools/glusterfind/src/libgfchangelog.py +++ b/tools/glusterfind/src/libgfchangelog.py @@ -9,8 +9,8 @@ # cases as published by the Free Software Foundation. import os -from ctypes import CDLL, get_errno, create_string_buffer, c_ulong, byref -from ctypes import RTLD_GLOBAL +from ctypes import CDLL, RTLD_GLOBAL, get_errno, create_string_buffer, c_ulong, byref +from ctypes.util import find_library from gfind_py2py3 import bytearray_to_str, gf_create_string_buffer from gfind_py2py3 import gfind_history_changelog, gfind_changelog_register from gfind_py2py3 import gfind_history_changelog_done @@ -19,8 +19,7 @@ from gfind_py2py3 import gfind_history_changelog_done class ChangelogException(OSError): pass - -libgfc = CDLL("libgfchangelog.so", use_errno=True, mode=RTLD_GLOBAL) +libgfc = CDLL(find_library("gfchangelog"), mode=RTLD_GLOBAL, use_errno=True) def raise_oserr(prefix=None): -- cgit