Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The following organizations or individuals have contributed to ScanCode:
- Hanif Ali @hanif-ali
- Horie Issei @is2ei
- James Ward @jamesward
- Jatin Pandey @satiricalguru
- Jelmer Vernooij @jelmer
- Jens Keim @pepper-jk
- Kunal Chhabra @kunalchhabra37
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
Next release
--------------

- Recognize GNU GPL v2 release notices without reporting unrelated composite licenses.
https://github.com/aboutcode-org/scancode-toolkit/issues/4942

- Fix the optional ``licenses`` extra dependency typo to install
``licensedcode-data``.
https://github.com/aboutcode-org/scancode-toolkit/pull/5056
Expand Down
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/gpl-2.0_1487.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: gpl-2.0
is_license_notice: yes
relevance: 100
notes: Rule found in test.cpp and tmp.cpp (#4942)
---

released under GNU GPL v2 only license
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/gpl-2.0_1488.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: gpl-2.0
is_license_notice: yes
relevance: 100
notes: Rule found in test.cpp and tmp.cpp (#4942)
---

released under GNU GPL v2 license
19 changes: 19 additions & 0 deletions tests/licensedcode/test_match_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,22 @@ def test_match_hash_returns_correct_offset(self):
assert match.rule == rules[0]
assert match.qspan == Span(0, 119)
assert match.ispan == Span(0, 119)

def test_issue_4942_gpl_2_0_release_notices(self):
# Reproduces issue #4942
from licensedcode.cache import get_index
idx = get_index()

queries = [
"* released under GNU GPL v2 only licence",
"* released under GNU GPL v2 licence",
"* released under GNU GPL v2 only license",
"* released under GNU GPL v2 license",
]
for q in queries:
matches = idx.match(query_string=q)
assert len(matches) == 1, f"Failed on {q}: {matches}"
m = matches[0]
assert m.rule.license_expression == "gpl-2.0", f"Wrong license on {q}: {m.rule.license_expression}"
assert m.matcher == match_hash.MATCH_HASH, f"Not a hash match on {q}: {m.matcher}"
assert m.coverage() == 100
Loading