[Libosinfo] [PATCH] configure: fix accidental break in soname

Christophe Fergeau cfergeau at redhat.com
Wed Aug 10 09:30:49 UTC 2016


On Wed, Aug 10, 2016 at 10:10:25AM +0100, Daniel P. Berrange wrote:
> The change in version from 0.3.0 to 1.0.0 triggered a latent
> bug in our code which sets the library soname. This meant we
> created libosinfo-1.0.so.1 instead of libosinfo-1.0.so.0
> 
> Pull in the fix from libvirt which is where the original logic
> was copied from.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  configure.ac | 40 +++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7276861..f002cab 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -73,12 +73,50 @@ LIBOSINFO_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
>  LIBOSINFO_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
>  LIBOSINFO_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
>  LIBOSINFO_VERSION=$LIBOSINFO_MAJOR_VERSION.$LIBOSINFO_MINOR_VERSION.$LIBOSINFO_MICRO_VERSION$LIBOSINFO_MICRO_VERSION_SUFFIX
> -LIBOSINFO_VERSION_INFO=`expr $LIBOSINFO_MAJOR_VERSION + $LIBOSINFO_MINOR_VERSION`:$LIBOSINFO_MICRO_VERSION:$LIBOSINFO_MINOR_VERSION
>  LIBOSINFO_VERSION_NUMBER=`expr $LIBOSINFO_MAJOR_VERSION \* 1000000 + $LIBOSINFO_MINOR_VERSION \* 1000 + $LIBOSINFO_MICRO_VERSION`
>  
> +# In libtool terminology we need to figure out:
> +#
> +# CURRENT
> +#     The most recent interface number that this library implements.
> +#
> +# REVISION
> +#     The implementation number of the CURRENT interface.
> +#
> +# AGE
> +#     The difference between the newest and oldest interfaces that this
> +#     library implements.
> +#
> +# In other words, the library implements all the interface numbers
> +# in the range from number `CURRENT - AGE' to `CURRENT'.
> +#
> +# Libtool assigns the soname version from `CURRENT - AGE', and we
> +# don't want that to ever change in libosinfo. ie it must always be
> +# zero, to produce libosinfo.so.0.
> +#
> +# We would, however, like the libosinfo version number reflected
> +# in the so version'd symlinks, and this is based on AGE.REVISION
> +# eg  libosinfo.so.0.AGE.REVISION
> +#
> +# Assuming we do ever want to break soname version, this can
> +# toggled. But seriously, don't ever touch this.
> +LIBOSINFO_SONUM=0
> +
> +# The following examples show what libtool will do
> +#
> +# Input: 0.3.0  ->   libosinfo.so.0.3.0
> +# Input: 1.0.0  ->   libosinfo.so.0.1000.0
> +# Input: 2.5.8  ->   libosinfo.so.0.2005.8
> +#
> +AGE=`expr $LIBOSINFO_MAJOR_VERSION '*' 1000 + $LIBOSINFO_MINOR_VERSION`
> +REVISION=$LIBOSINFO_MICRO_VERSION
> +CURRENT=`expr $LIBOSINFO_SONUM + $AGE`
> +LIBOSINFO_VERSION_INFO=$CURRENT:$REVISION:$AGE
> +
>  AC_SUBST([LIBOSINFO_MAJOR_VERSION])
>  AC_SUBST([LIBOSINFO_MINOR_VERSION])
>  AC_SUBST([LIBOSINFO_MICRO_VERSION])
> +AC_SUBST([LIBOSINFO_SONUM])

LIBOSINFO_SONUM seems to be unused?

We could add this to catch future unwanted soname changes:

diff --git a/libosinfo.spec.in b/libosinfo.spec.in
index 0feed84..eb0213e 100644
--- a/libosinfo.spec.in
+++ b/libosinfo.spec.in
@@ -118,7 +118,7 @@ rm -fr %{buildroot}
 %{_mandir}/man1/osinfo-detect.1*
 %{_mandir}/man1/osinfo-query.1*
 %{_mandir}/man1/osinfo-install-script.1*
-%{_libdir}/%{name}-1.0.so.*
+%{_libdir}/%{name}-1.0.so.0.*
 %if %{with_gir}
 %{_libdir}/girepository-1.0/Libosinfo-1.0.typelib
 %endif


>  AC_SUBST([LIBOSINFO_VERSION])
>  AC_SUBST([LIBOSINFO_VERSION_INFO])
>  AC_SUBST([LIBOSINFO_VERSION_NUMBER])
> -- 
> 2.7.4
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20160810/cc8245d5/attachment.sig>


More information about the Libosinfo mailing list