Subject: lintian: check that shlibs-version >= higher-version-symbols-file
Date: Tue, 17 Apr 2018 21:58:30 +0200
Package: lintian
Version: 2.5.82
Severity: wishlist
Hi,
It would be good to check that the version in a shlibs file doesn't
fall behind wrt the version in the .symbols file. E.g. one may have
a call to
dh_makeshlibs -plibfoo1 -V"1.0" -- -c4
updated when the 1.0 version got packaged, as it may have introduced
new symbols. Then, on an update to 1.1, new symbols may have been
introduced, and the maintainer would have updated the .symbols file
with the new symbols at version 1.1, but may have forgotten to update
the version in the dh_makeshlibs -V option (which ends up in the shlibs
file).
This is specially important for udebs, as they use the shlibs even
when .symbols files exist.
Another option would be for dh_makeshlibs to automatically use a
higher version if there's a higher one in the .symbols file. Not
sure we want to go that way though.
tl;dr: check if the shlibs CONTROL file in a .deb has a high enough
version as compared to MAX(versions in symbols CONTROL file)
Cheers,
Emilio
Acknowledgement sent
to Chris Lamb <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>.
(Fri, 20 Apr 2018 09:45:08 GMT) (full text, mbox, link).
tags 895953 + patch
thanks
Hi Emilio,
> lintian: check that shlibs-version >= higher-version-symbols-file
Patch attached - how does it look for you?
commit 62861f944168e42374609afcfc8eca3dab58e7fa
Author: Chris Lamb <[email protected]>
Date: Fri Apr 20 11:38:06 2018 +0200
Warn about packages with a "shlibs" version higher than the maximum version in the "symbol" control file. (Closes: #895953)
checks/shared-libs.desc | 21 +++++++++++++++++++++
checks/shared-libs.pm | 13 +++++++++++++
debian/changelog | 4 ++++
t/tests/shared-libs-control-file/desc | 2 ++
4 files changed, 40 insertions(+)
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
Acknowledgement sent
to Emilio Pozuelo Monfort <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>.
(Fri, 20 Apr 2018 19:39:08 GMT) (full text, mbox, link).
Subject: Re: lintian: check that shlibs-version >= higher-version-symbols-file
Date: Fri, 20 Apr 2018 21:35:45 +0200
On 20/04/18 11:44, Chris Lamb wrote:
> tags 895953 + patch
> thanks
>
> Hi Emilio,
>
>
>> lintian: check that shlibs-version >= higher-version-symbols-file
> Patch attached - how does it look for you?
>
> commit 62861f944168e42374609afcfc8eca3dab58e7fa
> Author: Chris Lamb <[email protected]>
> Date: Fri Apr 20 11:38:06 2018 +0200
>
> Warn about packages with a "shlibs" version higher than the maximum version in the "symbol" control file. (Closes: #895953)
We are warning against the opposite, i.e. we warn about packages whose shlibs
version is smaller then the one in the symbols file. Having a higher shlibs
version is fine, e.g. as the result of dh_makeshlibs -V.
>
> checks/shared-libs.desc | 21 +++++++++++++++++++++
> checks/shared-libs.pm | 13 +++++++++++++
> debian/changelog | 4 ++++
> t/tests/shared-libs-control-file/desc | 2 ++
> 4 files changed, 40 insertions(+)
>
>
> Regards,
>
> -- ,''`. : :' : Chris Lamb `. `'` [email protected] / chris-lamb.co.uk `-
>
>
> 0001-Warn-about-packages-with-a-shlibs-version-higher-tha.patch
>
>
>>From 62861f944168e42374609afcfc8eca3dab58e7fa Mon Sep 17 00:00:00 2001
> From: Chris Lamb <[email protected]>
> Date: Fri, 20 Apr 2018 11:38:06 +0200
> Subject: [PATCH] Warn about packages with a "shlibs" version higher than the
> maximum version in the "symbol" control file. (Closes: #895953)
>
> ---
> checks/shared-libs.desc | 21 +++++++++++++++++++++
> checks/shared-libs.pm | 13 +++++++++++++
> debian/changelog | 4 ++++
> t/tests/shared-libs-control-file/desc | 2 ++
> 4 files changed, 40 insertions(+)
>
> diff --git a/checks/shared-libs.desc b/checks/shared-libs.desc
> index 775a6199e..466a77737 100644
> --- a/checks/shared-libs.desc
> +++ b/checks/shared-libs.desc
> @@ -447,3 +447,24 @@ Info: The forms "<" and ">" mean "<=" and ">=", not "<<"
> and ">>" as one might expect. For that reason these forms are
> obsolete, and should not be used in new packages. Use the longer forms
> instead.
> +
> +Tag: shlibs-version-behind-symbols-file
> +Severity: normal
> +Certainty: certain
> +Ref: deb-symbols(5)
> +Info: The <tt>shlibs</tt> control file in this package contains
Here you mean symbols control file.
> + a versioned symbol that is higher than the maximum version in
> + the <tt>symbols</tt> control file. This can result in incorrect
And here you mean shlibs control file.
> + dependency generation.
> + .
> + This is specially important for udebs, as they use the
> + <tt>shlibs</tt> even when <tt>*.symbols</tt> files exist. This
> + typically happens when a package contains a call to:
> + .
> + dh_makeshlibs -plibfoo1 -V"1.0" -- -c4
> + .
> + which was not updated to, for example, <tt>-V"1.1"</tt> when
> + new symbols are introduced.
That's right. But there's another possible problem: the package may specify no
version for the shlibs, e.g.:
dh_makeshlibs -plibfoo1 -- -c4
That will generate a shlibs file with no version. That's a problem for the same
reason, but may need special treatment in the code (see below) and could be
mentioned here.
Looks good otherwise! Many thanks for implementing this.
Emilio
> + .
> + Please update your <tt>.symbols</tt> file or your call to
> + <tt>dh_makeshlibs</tt>.
> diff --git a/checks/shared-libs.pm b/checks/shared-libs.pm
> index 21902ea97..406ccea3b 100644
> --- a/checks/shared-libs.pm
> +++ b/checks/shared-libs.pm
> @@ -30,6 +30,7 @@ use Lintian::Data;
> use Lintian::Relation;
> use Lintian::Tags qw(tag);
> use Lintian::Util qw(internal_error strip);
> +use Lintian::Relation::Version qw(versions_gt);
>
> # Libraries that should only be used in the presence of certain capabilities
> # may be located in subdirectories of the standard ldconfig search path with
> @@ -460,6 +461,7 @@ sub run {
> my $meta_info_seen = 0;
> my $warned = 0;
> my $symbol_count = 0;
> + my ($max_symbol, $max_symbol_version);
>
> my $fd = $symbolsf->open;
> while (<$fd>) {
> @@ -544,6 +546,11 @@ sub run {
> my ($sym, $v, $dep_order) = ($1, $2, $3);
> $dep_order ||= '';
>
> + if (versions_gt($v, $max_symbol_version // '0-1')) {
> + $max_symbol = $sym;
> + $max_symbol_version = $v;
> + }
> +
> if (($v eq $version) and ($version =~ /-/)) {
> $full_version_sym ||= $sym;
> $full_version_count++;
> @@ -584,6 +591,12 @@ sub run {
> tag 'symbols-file-contains-debian-revision',
> "on symbol $debian_revision_sym$others";
> }
> +
> + tag 'shlibs-version-behind-symbols-file-entry',
> + $max_symbol, "$max_symbol_version > $version"
> + if defined $max_symbol_version
> + and versions_gt($max_symbol_version, $version);
> +
> for my $shlib (@shlibs, keys %unversioned_shlibs) {
> my $shlib_name = $SONAME{$shlib};
> $shlib_name = format_soname($shlib_name);
> diff --git a/debian/changelog b/debian/changelog
> index 2caa1c236..6ed77fdff 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -12,6 +12,10 @@ lintian (2.5.84) UNRELEASED; urgency=medium
> refers to upstream's policy followed by a suggestion that it may be
> dropped after the release of Debian "buster". Thanks to Adrian Bunk
> for the suggestion. (Closes: #896079)
> + * checks/shared-libs.{desc,pm}:
> + + [CL] Warn about packages with "shlibs" version that is higher than
> + the version in the "symbol" control file. Thanks to Emilio Pozuelo
> + Monfort for the suggestion. (Closes: #895953)
>
> * checks/{files.desc,menu-format.*}, data/menu-format/known-desktop-keys:
> + [PW] Link to the latest version for all FreeDesktop standards
> diff --git a/t/tests/shared-libs-control-file/desc b/t/tests/shared-libs-control-file/desc
> index 7350c9902..8d18ea082 100644
> --- a/t/tests/shared-libs-control-file/desc
> +++ b/t/tests/shared-libs-control-file/desc
> @@ -9,3 +9,5 @@ Test-For:
> shlibs-declares-dependency-on-other-package
> shlibs-uses-obsolete-relation
> unused-shlib-entry-in-control-file
> +Test-Against:
> + shlibs-version-behind-symbols-file
> -- 2.17.0
>
Acknowledgement sent
to Chris Lamb <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>.
(Fri, 20 Apr 2018 20:39:03 GMT) (full text, mbox, link).
Subject: Re: lintian: check that shlibs-version >= higher-version-symbols-file
Date: Fri, 20 Apr 2018 21:37:04 +0100
tags 895953 - patch
thanks
Hi Emilio,
> dh_makeshlibs -plibfoo1 -- -c4
>
> That will generate a shlibs file with no version. That's a problem for the same
> reason, but may need special treatment in the code
I've updated the description. However, your comment made me review
my own code and I've found a fairly large boo-boo in that I'm not
comparing the *shlibs* version but rather the "Version:" field of
the package itself.
Will get back to you when I've fixed that and untagging as "patch"
for the timebeing.
> Here you mean symbols control file.
[..]
> And here you mean shlibs control file.
Indeed! Both updated locally.. Well-caught, thank you.
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
Acknowledgement sent
to Chris Lamb <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>.
(Sat, 21 Apr 2018 15:39:02 GMT) (full text, mbox, link).
Subject: Re: Bug#895953: lintian: check that shlibs-version >=
higher-version-symbols-file
Date: Sat, 21 Apr 2018 16:36:02 +0100
Emilio,
> I've updated the description. However, your comment made me review
> my own code and I've found a fairly large boo-boo in that I'm not
> comparing the *shlibs* version
I just went to fix this but I've turned my brain into knots, but that
might also be the sun. Can you provide an known "good" shlibs/symbols
file pair and a known "bad" pair to match?
I can then use them as (almost-) literal testcases which I am
currently missing and it will also potentially prevent some
unnecessary back-and-forth and ultimately get this resolved quicker.
Thanks in advance. :)
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
Acknowledgement sent
to Chris Lamb <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>.
(Wed, 25 Apr 2018 07:15:02 GMT) (full text, mbox, link).
Subject: Re: Bug#895953: lintian: check that shlibs-version >=
higher-version-symbols-file
Date: Wed, 25 Apr 2018 08:13:40 +0100
tags 895953 + moreinfo
thanks
Hey Emilio,
> > I've updated the description. However, your comment made me review
> > my own code and I've found a fairly large boo-boo in that I'm not
> > comparing the *shlibs* version
>
> I just went to fix this but I've turned my brain into knots, but that
> might also be the sun. Can you provide an known "good" shlibs/symbols
> file pair and a known "bad" pair to match?
>
> I can then use them as (almost-) literal testcases which I am
> currently missing and it will also potentially prevent some
> unnecessary back-and-forth and ultimately get this resolved quicker.
Gentle ping on this? :)
Best wishes,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.