On Tue, Aug 07, 2018 at 10:38:59PM +0200, Lukas Slebodnik wrote: > On (07/08/18 15:48), Andreas Hasenack wrote: > >On Tue, Aug 7, 2018 at 10:19 AM Sumit Bose <[email protected]> wrote: > >> > >> > But something is still unexplained: the same test works just fine in > >> > debian, and doesn't try to connect to that socket. > >> > >> This is just linker magic. Due to my fault > >> sss_nss_make_request_timeout() is defined twice and which symbol is > >> picked might depend on specific linker options used. > > > >I just found out what option that was. Ubuntu, since many years, uses > >-Wl,-Bsymbolic-functions in its default linker flags. Debian doesn't. > > > >The moment I strip this flag from the build, the test passes. I can't > >do that for the official package build, but it's good to know what > >option was causing the test to fail. > > That would need to be disabled just for make check. > Because libsss_nss_idmap_tests.so which is used for testing is not the same > as libsss_nss_idmap.so which is used in reality. > > libsss_nss_idmap_tests.so also export function sss_nss_make_request_timeout > which is not exported in libsss_nss_idmap.so > > sh-4.4$ nm --defined-only --dynamic .libs/libsss_nss_idmap.so | grep request > sh-4.4$ nm --defined-only --dynamic .libs/libsss_nss_idmap_tests.so | grep > request > 0000000000004290 T sss_nss_make_request_timeout > > It was done to make testing possible and avoid copy&paste mistakes > > libsss_nss_idmap_tests_la_SOURCES = $(libsss_nss_idmap_la_SOURCES) > libsss_nss_idmap_tests_la_LIBADD = $(libsss_nss_idmap_la_LIBADD) > libsss_nss_idmap_tests_la_LDFLAGS = \ > $(libsss_nss_idmap_la_LDFLAGS) \ > -shared \ > -rpath $(libdir) \ > > -Wl,--version-script,$(srcdir)/src/sss_client/idmap/sss_nss_idmap.unit_tests > > > Other option would be to "include" all sources from library to test. > + use -Wl,-wrap,sss_nss_make_request_timeout > > > Or another hacky way to use weak symbols
Thank you for figuring out the linker option which caused the issue and for the suggestions. I've opened https://pagure.io/SSSD/sssd/issue/3801 to track the issue and also created https://github.com/SSSD/sssd/pull/632. I preferred using -Wl,-wrap to make it more consistent with other tests and hopefully also easier to understand. bye, Sumit > > diff --git a/Makefile.am b/Makefile.am > index ea7648bcd..7216561fb 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -2600,12 +2600,13 @@ test_authtok_LDADD = \ > $(NULL) > > sss_nss_idmap_tests_SOURCES = \ > - src/tests/cmocka/sss_nss_idmap-tests.c > + src/tests/cmocka/sss_nss_idmap-tests.c \ > + $(libsss_nss_idmap_la_SOURCES) > sss_nss_idmap_tests_CFLAGS = \ > $(AM_CFLAGS) > sss_nss_idmap_tests_LDADD = \ > $(CMOCKA_LIBS) \ > - libsss_nss_idmap_tests.la \ > + $(libsss_nss_idmap_la_LIBADD) \ > $(NULL) > > deskprofile_utils_tests_SOURCES = \ > diff --git a/src/sss_client/common.c b/src/sss_client/common.c > index 67a460705..a93aaff16 100644 > --- a/src/sss_client/common.c > +++ b/src/sss_client/common.c > @@ -718,6 +718,7 @@ static enum sss_status sss_cli_check_socket(int *errnop, > > /* this function will check command codes match and returned length is ok */ > /* repbuf and replen report only the data section not the header */ > +__attribute((weak)) > enum nss_status sss_nss_make_request_timeout(enum sss_cli_command cmd, > struct sss_cli_req_data *rd, > int timeout, > > LS > > _______________________________________________ > sssd-users mailing list -- [email protected] > To unsubscribe send an email to [email protected] > Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines > List Archives: > https://lists.fedoraproject.org/archives/list/[email protected]/message/E2FPZZCLH6YOL2I3FC5R77GFQXZDHRKT/ _______________________________________________ sssd-users mailing list -- [email protected] To unsubscribe send an email to [email protected] Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/[email protected]/message/LJX5IDXRZDNSQ5U3DJWLVIOZ3DLZE2QA/
