Re: [PATCH] tests: Put a mock library at the start of LD_PRELOAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 30, 2013 at 11:29:11AM +0200, Jiri Denemark wrote:
> This fixes vircgrouptest when run in a sandbox which already overrides
> open() and others.

In general I think that having multiple LD_PRELOADS overriding the
same symbols may well lead to pain.

We try to make it at least chain up the libraries by using the
'RTLD_NEXT' handle when looking up the "real" symbol, which
should make it forward to the next preloaded library. From
the sound of it, your sandbox tool isn't using RTLD_NEXT,
causing the libvirt override to be skipped when the order was
reversed.

> ---
>  tests/testutils.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/testutils.h b/tests/testutils.h
> index 27af5da..8583747 100644
> --- a/tests/testutils.h
> +++ b/tests/testutils.h
> @@ -87,8 +87,9 @@ int virtTestMain(int argc,
>                  perror(lib);                                            \
>                  return EXIT_FAILURE;                                    \
>              }                                                           \
> -            if (virAsprintf(&newenv, "%s%s%s", preload ? preload : "",  \
> -                            preload ? ":" : "", lib) < 0) {             \
> +            if (!preload) {                                             \
> +                newenv = (char *) lib;                                  \
> +            } else if (virAsprintf(&newenv, "%s:%s", lib, preload) < 0) {   \
>                  perror("virAsprintf");                                  \
>                  return EXIT_FAILURE;                                    \
>              }                                                           \

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]