Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian....@packages.debian.org
Usertags: pu

This is a pre-approval request for feature-check/0.2.2-3+deb10u1 to
fix the #990276 RC bug already fixed in unstable.

[ Reason ]
See #990276 (https://bugs.debian.org/990276): Version comparisons may
return the wrong result.

[ Impact ]
If the feature-check command-line tool is used by other programs to
make sure that an installed program has a recent enough version of
a supported feature, the checks may fail for some versions containing
non-numeric characters (pre-release, patch, etc).

[ Tests ]
The patches include additions to the feature-check unit-test suite that
is run both at build time and as an autopkgtest.

[ Risks ]
Leaf package, not widely used yet; targeted fix, so hopefully
any risks are very low.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
In my infinite wisdom of > 20 years of Perl programming, I managed to
switch around the "cmp" and "<=>" comparison operators for integer and
string values, leading to, mm, incorrect results and diagnostic messages.
The changes switch the operators back and add test cases covering
the relevant usage.
diff -Nru feature-check-0.2.2/debian/changelog 
feature-check-0.2.2/debian/changelog
--- feature-check-0.2.2/debian/changelog        2019-02-26 17:08:55.000000000 
+0200
+++ feature-check-0.2.2/debian/changelog        2021-06-27 17:49:55.000000000 
+0300
@@ -1,3 +1,10 @@
+feature-check (0.2.2-3+deb10u1) buster; urgency=medium
+
+  * Add the cmp-num and cmp-rest upstream patches to fix some version
+    string comparisons. Closes: #990276
+
+ -- Peter Pentchev <r...@debian.org>  Sun, 27 Jun 2021 17:49:55 +0300
+
 feature-check (0.2.2-3) unstable; urgency=medium
 
   * Switch to a DEP-14 debian/master branch.
diff -Nru feature-check-0.2.2/debian/patches/cmp-num.patch 
feature-check-0.2.2/debian/patches/cmp-num.patch
--- feature-check-0.2.2/debian/patches/cmp-num.patch    1970-01-01 
02:00:00.000000000 +0200
+++ feature-check-0.2.2/debian/patches/cmp-num.patch    2021-06-27 
17:49:55.000000000 +0300
@@ -0,0 +1,46 @@
+Description: Fix a 2 < 10 version int/string bug.
+Origin: upstream; 
https://gitlab.com/ppentchev/feature-check/-/commit/ed0da5159562fa37cf32386a1baf2a1114562822
+Bug-Debian: https://bugs.debian.org/990276
+Author: Peter Pentchev <r...@ringlet.net>
+Last-Update: 2021-06-24
+
+--- a/perl5/feature-check.pl
++++ b/perl5/feature-check.pl
+@@ -269,7 +269,7 @@
+       if ($na ne '') {
+               if ($nb ne '') {
+                       if ($nb != $na) {
+-                              return $na cmp $nb;
++                              return $na <=> $nb;
+                       }
+               } else {
+                       return 1;
+--- a/t/04-simple.t
++++ b/t/04-simple.t
+@@ -1,6 +1,6 @@
+ #!/usr/bin/perl
+ #
+-# Copyright (c) 2018  Peter Pentchev
++# Copyright (c) 2018, 2021  Peter Pentchev
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+@@ -89,6 +89,18 @@
+       ['base ge 3', 0],
+       ['base gt 3', 0],
+       ['base eq 3', 0],
++
++      ['base lt 10', 1],
++      ['base le 10', 1],
++      ['base ge 10', 0],
++      ['base gt 10', 0],
++      ['base eq 10', 0],
++
++      ['base lt 10.1', 1],
++      ['base le 10.1', 1],
++      ['base ge 10.1', 0],
++      ['base gt 10.1', 0],
++      ['base eq 10.1', 0],
+ );
+ 
+ my %c = env_init;
diff -Nru feature-check-0.2.2/debian/patches/cmp-rest.patch 
feature-check-0.2.2/debian/patches/cmp-rest.patch
--- feature-check-0.2.2/debian/patches/cmp-rest.patch   1970-01-01 
02:00:00.000000000 +0200
+++ feature-check-0.2.2/debian/patches/cmp-rest.patch   2021-06-27 
17:49:55.000000000 +0300
@@ -0,0 +1,62 @@
+Description: Fix a 3.0.beta2 < 3.0 version int/string bug.
+Origin: upstream; 
https://gitlab.com/ppentchev/feature-check/-/commit/59e618baff6836f281697561f5a9cfa22ccd28df
+Bug-Debian: https://bugs.debian.org/990276
+Author: Peter Pentchev <r...@ringlet.net>
+Last-Update: 2021-06-24
+
+--- a/perl5/feature-check.pl
++++ b/perl5/feature-check.pl
+@@ -282,7 +282,7 @@
+       if ($ra ne '') {
+               if ($rb ne '') {
+                       if ($ra ne $rb) {
+-                              return $ra <=> $rb;
++                              return $ra cmp $rb;
+                       }
+               } else {
+                       return 1;
+--- a/t/04-simple.t
++++ b/t/04-simple.t
+@@ -101,6 +101,42 @@
+       ['base ge 10.1', 0],
+       ['base gt 10.1', 0],
+       ['base eq 10.1', 0],
++
++      ['beta lt 1', 0],
++      ['beta le 1', 0],
++      ['beta eq 1', 0],
++      ['beta ge 1', 1],
++      ['beta gt 1', 1],
++
++      ['beta lt 3.0', 1],
++      ['beta le 3.0', 1],
++      ['beta eq 3.0', 0],
++      ['beta ge 3.0', 0],
++      ['beta gt 3.0', 0],
++
++      ['beta lt 3.0.beta1', 0],
++      ['beta le 3.0.beta1', 0],
++      ['beta eq 3.0.beta1', 0],
++      ['beta ge 3.0.beta1', 1],
++      ['beta gt 3.0.beta1', 1],
++
++      ['beta lt 3.0.beta2', 0],
++      ['beta le 3.0.beta2', 1],
++      ['beta eq 3.0.beta2', 1],
++      ['beta ge 3.0.beta2', 1],
++      ['beta gt 3.0.beta2', 0],
++
++      ['beta lt 3.0.beta3', 1],
++      ['beta le 3.0.beta3', 1],
++      ['beta eq 3.0.beta3', 0],
++      ['beta ge 3.0.beta3', 0],
++      ['beta gt 3.0.beta3', 0],
++
++      ['beta lt 3.0.0', 1],
++      ['beta le 3.0.0', 1],
++      ['beta eq 3.0.0', 0],
++      ['beta ge 3.0.0', 0],
++      ['beta gt 3.0.0', 0],
+ );
+ 
+ my %c = env_init;
diff -Nru feature-check-0.2.2/debian/patches/series 
feature-check-0.2.2/debian/patches/series
--- feature-check-0.2.2/debian/patches/series   2019-01-14 16:45:12.000000000 
+0200
+++ feature-check-0.2.2/debian/patches/series   2021-06-27 17:49:04.000000000 
+0300
@@ -1 +1,3 @@
 python-no-executable.patch
+cmp-num.patch
+cmp-rest.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to