diff options
author | Richard Levitte <levitte@openssl.org> | 2018-11-13 00:16:55 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2018-11-14 00:41:57 +0100 |
commit | 18289399743da6c3db462f37fc8797738e8acf7c (patch) | |
tree | b5b0b6ce1fa84cd37fe27a2d26b9a515b32b3a2f /test/recipes | |
parent | 6e624a645300d784eaa97ddda29364081ede36d7 (diff) |
Fix rpath-related Linux "test_shlibload" failure.
When libssl and libcrypto are compiled on Linux with "-rpath", but
not "--enable-new-dtags", the RPATH takes precedence over
LD_LIBRARY_PATH, and we end up running with the wrong libraries.
This is resolved by using full (or at least relative, rather than
just the filename to be found on LD_LIBRARY_PATH) paths to the
shared objects.
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7626)
Diffstat (limited to 'test/recipes')
-rw-r--r-- | test/recipes/90-test_shlibload.t | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/test/recipes/90-test_shlibload.t b/test/recipes/90-test_shlibload.t index 368dea3171..2761d58502 100644 --- a/test/recipes/90-test_shlibload.t +++ b/test/recipes/90-test_shlibload.t @@ -6,8 +6,7 @@ # in the file LICENSE in the source distribution or at # https://www.openssl.org/source/license.html - -use OpenSSL::Test qw/:DEFAULT bldtop_dir/; +use OpenSSL::Test qw/:DEFAULT bldtop_dir bldtop_file/; use OpenSSL::Test::Utils; #Load configdata.pm @@ -23,12 +22,13 @@ plan skip_all => "Test is disabled on AIX" if config('target') =~ m|^aix|; plan tests => 4; -my $libcrypto_idx = $unified_info{rename}->{libcrypto} // "libcrypto"; -my $libssl_idx = $unified_info{rename}->{libssl} // "libssl"; -my $libcrypto = - $unified_info{sharednames}->{$libcrypto_idx}.$target{shared_extension_simple}; -my $libssl = - $unified_info{sharednames}->{$libssl_idx}.$target{shared_extension_simple}; +# When libssl and libcrypto are compiled on Linux with "-rpath", but not +# "--enable-new-dtags", the RPATH takes precedence over LD_LIBRARY_PATH, +# and we end up running with the wrong libraries. This is resolved by +# using paths to the shared objects, not just the names. + +my $libcrypto = bldtop_file(shlib('libcrypto')); +my $libssl = bldtop_file(shlib('libssl')); ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl])), "running shlibloadtest -crypto_first"); @@ -39,3 +39,14 @@ ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl])), ok(run(test(["shlibloadtest", "-dso_ref", $libcrypto, $libssl])), "running shlibloadtest -dso_ref"); +sub shlib { + my $lib = shift; + $lib = $unified_info{rename}->{$lib} + if defined $unified_info{rename}->{$lib}; + $lib = $unified_info{sharednames}->{$lib} + . ($target{shlib_variant} || "") + . ($target{shared_extension} || ".so"); + $lib =~ s|\.\$\(SHLIB_VERSION_NUMBER\) + |.$config{shlib_version_number}|x; + return $lib; +} |