On Tue, 2013-11-12 at 16:23 +0100, Lukas Slebodnik wrote:
On (12/11/13 11:15), Jakub Hrozek wrote:
>> From b044b85ac073ed068796a9365715155c6edd8fd8 Mon Sep 17 00:00:00 2001
>> From: Lukas Slebodnik <lslebodn(a)redhat.com>
>> Date: Mon, 11 Nov 2013 19:39:17 +0100
>> Subject: [PATCH 3/3] TEST: Add libsss_krb5_common.so to dlopen test
>>
>> ---
>> Makefile.am | 6 ++++--
>> src/tests/dlopen-tests.c | 2 ++
>> 2 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index
62e31a6fe4a22e8d98f73a6fb3c3e39ae3710555..cb23fe4764d7aa831359e21b59a033c32c3a25fa 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -1580,9 +1580,11 @@ libsss_krb5_common_la_SOURCES = \
>> src/providers/krb5/krb5_auth.c \
>> src/providers/krb5/krb5_access.c \
>> src/providers/krb5/krb5_child_handler.c \
>> - src/providers/krb5/krb5_init_shared.c
>> + src/providers/krb5/krb5_init_shared.c \
>> + src/util/sss_krb5.c
>
>Why was sss_krb5.c and KRB5_LIBS added in this patch?
>
Variable KRB5_LIBS was added because libsss_krb5_common.so directly call krb5
functions and dlopen test failed without it.
bash$ objdump -T .libs/libsss_krb5_common.so | grep -E "UND.*krb5_" | tail
-n5
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_cc_destroy
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_set_trace_callback
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_parse_name_flags
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_kt_resolve
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_cc_set_default_name
dlopen test failed without file sss_krb5.c
bash$ ./dlopen-tests
Running suite(s): dlopen
0%: Checks: 1, Failures: 1, Errors: 0
./src/tests/dlopen-tests.c:131:F:dlopen:test_dlopen_base:0:
Error opening libsss_krb5_common.so: [dlopen() failed:
./sssd_build/.libs/libsss_krb5_common.so: undefined symbol: check_fast]
Updated patches are attached.
This is not the right way to fix the failure.
That library *knowingly* has missing symbols because it is an internal
library.
You need to build or link to an outer program that have only the
necessary symbols you know are going to be available.
In this case those symbols are in libsss_krb5.so, so all you should nee
to do is to have this in tests:
+ { "libsss_krb5_common.so", {
LIBPFX"libdlopen_test_providers.so",
+ LIBPFX"libsss_krb5_common.so",
+ LIBPFX"libsss_krb5.so",
+ NULL } },
Adding c files to librraies to "make them pass" the dl-open test is
wrong in 99% of the cases. you are just making the test pass not testing
that the libraries have the right dependencies. In particular for
internal modules you really need to understand the hierarchy of the
modules and link in the test all the necessary dependencies before
thinking of adding any file to the module itself.
In this case what you did was to duplicate symblos in the resulting Text
file, and that can potentially cause very serious consequencies if any
of those symbols is a static symbols that is meant to have a share de
value all code rely on.
Simo.
--
Simo Sorce * Red Hat, Inc * New York