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

[lintian] 01/02: c/java: Fix "max-bytecode-*" handling



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 00c75b6e42e0e39a3827e9f56961b952b260a758
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jun 6 21:47:34 2015 +0200

    c/java: Fix "max-bytecode-*" handling
    
    The max-bytecode-existing-version suffered from an "off-by-one"
    causing it to reject Java8 as unknown.
    
    The "max-bytecode-version" hardcoded the "bad" version to be "max +
    1", which would fail to detect a "max + 2 (or more)" should the need
    ever arise.  Though due to the abovementioned "off-by-one", said need
    never occurred until now.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/java.pm   | 13 +++++++------
 debian/changelog |  3 +++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/checks/java.pm b/checks/java.pm
index 2039974..f4b7348 100644
--- a/checks/java.pm
+++ b/checks/java.pm
@@ -88,7 +88,7 @@ sub run {
             next if $mver eq '-';
             if (   $mver <= $MAX_BYTECODE->value('min-bytecode-version') - 1
                 or $mver
-                >= $MAX_BYTECODE->value('max-bytecode-existing-version')) {
+                > $MAX_BYTECODE->value('max-bytecode-existing-version')) {
                 # First public major version was 45 (Java1), latest
                 # version is 52 (Java8).
                 tag 'unknown-java-class-version', $jar_file,
@@ -215,13 +215,14 @@ sub run {
         #     52 -> Java8
         my $bad = 0;
 
-        # If the lowest version used is:
+        # If the lowest version used is greater than the requested
+        # limit, then flag it.
         $bad = 1
-          if $jmajlow == $MAX_BYTECODE->value('max-bytecode-version')
-          + 1; # Java7 - consider bad per request.
+          if $jmajlow > $MAX_BYTECODE->value('max-bytecode-version');
 
-       # Technically we ought to do some checks with Java6 class files and
-       # dependencies/package types, but for now just skip that.  (See #673276)
+        # Technically we ought to do some checks with Java6 class
+        # files and dependencies/package types, but for now just skip
+        # that.  (See #673276)
 
         if ($bad) {
             # Map the Class version to a Java version.
diff --git a/debian/changelog b/debian/changelog
index f84d439..0804ac7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,9 @@ lintian (2.5.32) UNRELEASED; urgency=medium
       directories.
     + [BR] Avoid a false positive in jsom for defaultpresets.xml
       from openmapstreet.
+  * checks/java.pm:
+    + [NT] Fix "off-by-one" in the check for the maximum permitted
+      Java major version.
   * checks/manpages.{desc,pm}:
     + [NT] Retire the hyphen-used-as-minus-sign tag as upstream now
       renders both "-" and "\-" as HYPHEN-MINUS.  (Closes: #785353)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: