[libvirt PATCH] nss: Use shared_library() for nss_libvirt_lib

Andrea Bolognani posted 1 patch 2 years, 4 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211211002720.18735-1-abologna@redhat.com
tools/nss/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] nss: Use shared_library() for nss_libvirt_lib
Posted by Andrea Bolognani 2 years, 4 months ago
shared_module() is intended for shared objects that are
loaded at runtime using dlopen() whereas NSS plugins need to
be full-fledged shared libraries with, among other things, a
proper SONAME.

Meson seems to have become more strict about this recently,
because libnss_libvirt.so.2 gets a SONAME when I build it with
Meson 0.59.4 on Fedora 34 but doesn't when I use Meson 0.60.2
on Debian testing instead.

Either way, shared_library() was always the right function
to use for NSS plugins.

Fixes: 36780c931900555706fd6db9fc2ce2b4cabf9045
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 tools/nss/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/nss/meson.build b/tools/nss/meson.build
index 198936f3d4..f77309ebca 100644
--- a/tools/nss/meson.build
+++ b/tools/nss/meson.build
@@ -59,7 +59,7 @@ nss_libvirt_guest_syms = '@0@@1@'.format(
   meson.current_source_dir() / nss_guest_sym_file,
 )
 
-nss_libvirt_lib = shared_module(
+nss_libvirt_lib = shared_library(
   'nss_libvirt',
   name_prefix: nss_prefix,
   name_suffix: 'so.@0@'.format(nss_so_ver),
-- 
2.31.1

Re: [libvirt PATCH] nss: Use shared_library() for nss_libvirt_lib
Posted by Michal Prívozník 2 years, 4 months ago
On 12/11/21 01:27, Andrea Bolognani wrote:
> shared_module() is intended for shared objects that are
> loaded at runtime using dlopen() whereas NSS plugins need to
> be full-fledged shared libraries with, among other things, a
> proper SONAME.
> 
> Meson seems to have become more strict about this recently,
> because libnss_libvirt.so.2 gets a SONAME when I build it with
> Meson 0.59.4 on Fedora 34 but doesn't when I use Meson 0.60.2
> on Debian testing instead.
> 
> Either way, shared_library() was always the right function
> to use for NSS plugins.
> 
> Fixes: 36780c931900555706fd6db9fc2ce2b4cabf9045
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  tools/nss/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/nss/meson.build b/tools/nss/meson.build
> index 198936f3d4..f77309ebca 100644
> --- a/tools/nss/meson.build
> +++ b/tools/nss/meson.build
> @@ -59,7 +59,7 @@ nss_libvirt_guest_syms = '@0@@1@'.format(
>    meson.current_source_dir() / nss_guest_sym_file,
>  )
>  
> -nss_libvirt_lib = shared_module(
> +nss_libvirt_lib = shared_library(
>    'nss_libvirt',
>    name_prefix: nss_prefix,
>    name_suffix: 'so.@0@'.format(nss_so_ver),

I'm unable to see any difference on rawhide with
meson-0.60.2-1.fc36.noarch but libvirt_guest is built with
shared_library() so I guess it works.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal

Re: [libvirt PATCH] nss: Use shared_library() for nss_libvirt_lib
Posted by Daniel P. Berrangé 2 years, 4 months ago
On Mon, Dec 13, 2021 at 12:07:36PM +0100, Michal Prívozník wrote:
> On 12/11/21 01:27, Andrea Bolognani wrote:
> > shared_module() is intended for shared objects that are
> > loaded at runtime using dlopen() whereas NSS plugins need to
> > be full-fledged shared libraries with, among other things, a
> > proper SONAME.
> > 
> > Meson seems to have become more strict about this recently,
> > because libnss_libvirt.so.2 gets a SONAME when I build it with
> > Meson 0.59.4 on Fedora 34 but doesn't when I use Meson 0.60.2
> > on Debian testing instead.
> > 
> > Either way, shared_library() was always the right function
> > to use for NSS plugins.
> > 
> > Fixes: 36780c931900555706fd6db9fc2ce2b4cabf9045
> > Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> > ---
> >  tools/nss/meson.build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/nss/meson.build b/tools/nss/meson.build
> > index 198936f3d4..f77309ebca 100644
> > --- a/tools/nss/meson.build
> > +++ b/tools/nss/meson.build
> > @@ -59,7 +59,7 @@ nss_libvirt_guest_syms = '@0@@1@'.format(
> >    meson.current_source_dir() / nss_guest_sym_file,
> >  )
> >  
> > -nss_libvirt_lib = shared_module(
> > +nss_libvirt_lib = shared_library(
> >    'nss_libvirt',
> >    name_prefix: nss_prefix,
> >    name_suffix: 'so.@0@'.format(nss_so_ver),
> 
> I'm unable to see any difference on rawhide with
> meson-0.60.2-1.fc36.noarch but libvirt_guest is built with
> shared_library() so I guess it works.

I did see a note in the glibc info pages that obliquely references
the fact that NSS modules are supposed to be built as "normal"
libraries, despite fact that they're dlopened. So this does seem
logical as a fix

> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

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