Skip to content
Snippets Groups Projects
Commit fce1548e authored by Simon McVittie's avatar Simon McVittie
Browse files

tests/capture-libs: Tolerate path to ld.so not being fully resolved


--resolve-ld.so would ideally be the equivalent of realpath or
readlink -f, but in fact it only has special handling for symlinks in
the last position in the pathname (like AT_SYMLINK_NOFOLLOW and
O_NOFOLLOW), leading to different results on at least Arch Linux.

The pressure-vessel utility for which this option was added does not
actually use it any more, so fixing this is not a high priority right now.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 6f2606cd
Branches
Tags
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
...@@ -297,14 +297,52 @@ SKIP: { ...@@ -297,14 +297,52 @@ SKIP: {
diag "ld.so is $ld_so"; diag "ld.so is $ld_so";
run_ok([$CAPSULE_CAPTURE_LIBS_TOOL, '--resolve-ld.so=/'], '>', \$stdout); run_ok([$CAPSULE_CAPTURE_LIBS_TOOL, '--resolve-ld.so=/'], '>', \$stdout);
my $resolved = $stdout;
chomp $resolved;
is(abs_path($resolved), abs_path($ld_so),
'--resolve-ld.so=/ should print a path to '.abs_path($ld_so));
ok(! -l $resolved,
'--resolve-ld.so=/ should not print a symlink');
# Autotools considers an unexpected pass to be a test failure, so we
# have to second-guess whether this is going to work.
if ($stdout eq abs_path($ld_so)."\n") {
is($stdout, abs_path($ld_so)."\n",
'--resolve-ld.so=/ should print '.abs_path($ld_so));
}
else {
TODO: {
local $TODO = 'symlinks before the last component are not resolved, '
.'e.g. /lib64 -> usr/lib on Arch Linux';
is($stdout, abs_path($ld_so)."\n",
'--resolve-ld.so=/ should print '.abs_path($ld_so));
}
}
is($stdout, abs_path($ld_so)."\n",
'--resolve-ld.so=/ should print '.abs_path($ld_so));
run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host, run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host,
$CAPSULE_CAPTURE_LIBS_TOOL, "--resolve-ld.so=$host"], $CAPSULE_CAPTURE_LIBS_TOOL, "--resolve-ld.so=$host"],
'>', \$stdout); '>', \$stdout);
is($stdout, abs_path($ld_so)."\n", $resolved = $stdout;
"--resolve-ld.so=$host should print ".abs_path($ld_so)); chomp $resolved;
is(abs_path($resolved), abs_path($ld_so),
"--resolve-ld.so=$host should print a path to ".abs_path($ld_so));
ok(! -l $resolved,
"--resolve-ld.so=$host should not print a symlink");
if ($stdout eq abs_path($ld_so)."\n") {
is($stdout, abs_path($ld_so)."\n",
"--resolve-ld.so=$host should print ".abs_path($ld_so));
}
else {
TODO: {
local $TODO = 'symlinks before the last component are not resolved, '
.'e.g. /lib64 -> usr/lib on Arch Linux';
is($stdout, abs_path($ld_so)."\n",
"--resolve-ld.so=$host should print ".abs_path($ld_so));
}
}
}; };
SKIP: { SKIP: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment