Skip to content

SCTK 30.1.0 detects classpath-exception-2.0 based only on word "classpath" in Java comments #2769

Closed

Description

@mjherzog

Description

Please leave a brief description of the bug or feature request:

SCTK reports a license_score=7.33 for a set of Java files based only on the word "classpath" in comments.
The match details are:
matched_rule_identifier = classpath-exception-2.0_5.RULE
matched_rule_matcher = 2-aho
matched_rule_length = 2
matched_rule_match_coverage = 2
matched-rule_relevance = 11

Since the word "classpath" is likely to appear frequently in Java comments, it would be good to avoid this false positive.

  • What version of scancode-toolkit was used to generate the scan file? version 30.1.0

Activity

  1. pombredanne commented on Nov 27, 2021

    @pombredanne
    Member

    This make sense but https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/rules/classpath-exception-2.0_5.RULE has this text classpath exception

    Would you have a file with the problematic detection to link or attach?

  2. pombredanne commented on Nov 27, 2021

    @pombredanne
    Member

    Never mind I can the see the issue now. For instance this C++ snippet from https://github.com/SanDisk-Open-Source/SSD_Dashboard/blob/f0240a983544a86989eec80a9a5210f2b14fa1c1/uefi/gcc/gcc-4.6.3/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc#L280:

    	    using namespace gnu::classpath::jdwp::exception;
    	    throw new InvalidLocationException ();

    is detected by this rule and with matched_text: classpath::[jdwp]::exception; and it should not be detected if there are extra words between classpath and exception

  3. self-assigned this
    on Apr 10, 2025
  4. DennisClark commented on Apr 10, 2025

    @DennisClark
    Member

    I scanned file natVMVirtualMachine.cc using scancode-toolkit-3.2.3 and the results, though somewhat unexpected, appear to be correct. Closing.

    The following match is interesting in the context of this issue:

      "license_detections": [
        {
          "identifier": "gpl_2_0_plus_with_classpath_exception_2_0-55d6f818-b730-1e21-d755-dc0dcf016bad",
          "license_expression": "gpl-2.0-plus WITH classpath-exception-2.0",
          "license_expression_spdx": "GPL-2.0-or-later WITH Classpath-exception-2.0",
          "detection_count": 1,
          "reference_matches": [
            {
              "license_expression": "gpl-2.0-plus WITH classpath-exception-2.0",
              "license_expression_spdx": "GPL-2.0-or-later WITH Classpath-exception-2.0",
              "from_file": "natVMVirtualMachine.cc",
              "start_line": 7,
              "end_line": 9,
              "matcher": "2-aho",
              "score": 100.0,
              "matched_length": 21,
              "match_coverage": 100.0,
              "rule_relevance": 100,
              "rule_identifier": "gpl-2.0-plus_with_classpath-exception-2.0_11.RULE",
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl-2.0-plus_with_classpath-exception-2.0_11.RULE"
            }
          ]
        }
      ],
    

    The matched text in natVMVirtualMachine.cc is:

       This file is part of libgcj.
    
    This software is copyrighted work licensed under the terms of the
    Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
    details.
    

    The file LIBGCJ_LICENSE at https://github.com/SanDisk-Open-Source/SSD_Dashboard/blob/f0240a983544a86989eec80a9a5210f2b14fa1c1/uefi/gcc/gcc-4.6.3/libjava/LIBGCJ_LICENSE contains this text, which explains the match on GPL-2.0-or-later WITH Classpath-exception-2.0

    Jan 21, 2002
    
    The libgcj library is licensed under the terms of the GNU General
    Public License.
    
    Linking this library statically or dynamically with other modules is
    making a combined work based on this library.  Thus, the terms and
    conditions of the GNU General Public License cover the whole
    combination.
    
    As a special exception, the copyright holders of this library give you
    permission to link this library with independent modules to produce an
    executable, regardless of the license terms of these independent
    modules, and to copy and distribute the resulting executable under
    terms of your choice, provided that you also meet, for each linked
    independent module, the terms and conditions of the license of that
    module.  An independent module is a module which is not derived from
    or based on this library.  If you modify this library, you may extend
    this exception to your version of the library, but you are not
    obligated to do so.  If you do not wish to do so, delete this
    exception statement from your version.
    
    You should have received a copy of the GNU General Public License
    along with libjava; see the file COPYING.  If not, write to the
    Free Software Foundation, 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
    

    natVMVirtualMachine.cc.zip
    natVMVirtualMachine.cc-results.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions