Re: [sandbox PATCH 1/2] builder: Use prefix '=> /' to identify lib path

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

 



On Tue, Nov 20, 2018 at 07:10:19PM +0000, Radostin Stoyanov wrote:
> The output of ldd might contain a fully qualified path on the left
> hand side of the '=>'. For example:
> 
> (glibc 2.28)
> $ ldd /usr/libexec/libvirt-sandbox-init-common  | grep ld
>     /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fcdceb96000)
> 
> (glibc 2.27)
> $ ldd /usr/libexec/libvirt-sandbox-init-common | grep ld
>     /lib64/ld-linux-x86-64.so.2 (0x00007f18135eb000)
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1@xxxxxxxxx>
> ---
>  libvirt-sandbox/libvirt-sandbox-builder.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/libvirt-sandbox/libvirt-sandbox-builder.c b/libvirt-sandbox/libvirt-sandbox-builder.c
> index 8cfc2f4..7058112 100644
> --- a/libvirt-sandbox/libvirt-sandbox-builder.c
> +++ b/libvirt-sandbox/libvirt-sandbox-builder.c
> @@ -297,7 +297,7 @@ static gboolean gvir_sandbox_builder_copy_program(const char *program,
>      /* Loop over the output lines to get the path to the libraries to copy */
>      line = out;
>      while ((tmp = strchr(line, '\n'))) {
> -        gchar *start, *end;
> +        gchar *start, *end, *tmp2;
>          *tmp = '\0';
>  
>          /* Search the line for the library path */
> @@ -308,22 +308,20 @@ static gboolean gvir_sandbox_builder_copy_program(const char *program,
>              const gchar *newname = NULL;
>              *end = '\0';
>  
> +            if ((tmp2 = strstr(start, "=> ")))
> +                start = tmp2 + 3;
> +
>              /* There are countless different naming schemes for
>               * the ld-linux.so library across architectures. Pretty
>               * much the only thing in common is they start with
> -             * the two letters 'ld'. The LDD program prints it
> -             * out differently too - it doesn't include " => "
> -             * as this library is special - its actually a static
> -             * linked executable not a library.
> +             * the two letters 'ld'.
>               *
>               * To make life easier for libvirt-sandbox-init-{qemu,lxc}
>               * we just call the file 'ld.so' when we copy it into our
>               * scratch dir, no matter what it was called on the host.
>               */
> -            if (!strstr(line, " => ") &&
> -                strstr(start, "/ld")) {
> +            if (strstr(start, "/ld"))
>                  newname = "ld.so";
> -            }
>  
>              if (!gvir_sandbox_builder_copy_file(start, dest, newname, error))
>                  goto cleanup;

Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
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]

  Powered by Linux