#1139580 libstring-license-perl: seems unable to notice -or-later in SPDX-License-Identifiers

#1139580#5
Date:
2026-06-09 22:54:45 UTC
From:
To:
[I would guess that this is the same bug as 1135671, in which case they should
 probably be merged]

Hi,

Prompted by `lrc` telling me that a file that contains:

  SPDX-License-Identifier: GPL-2.0-or-later.

has a license of 'GPL-2', rather than 'GPL-2+', I thought I'd try to work out
why that is.

I didn't manage to track down exactly why it does that, but I do have a couple
of minimal tests that suggest that it is due to String::License

$ perl -M5.010 -MString::License -e 'say String::License->new( string => "under the terms of GNU General Public License either version 2, or later." )->as_text'

GPL-2.0-or-later

$ perl -M5.010 -MString::License -e 'say String::License->new( string => "SPDX-License-Identifier: GPL-2.0-or-later." )->as_text'

GPL-2

It seems to me that the second one of those should also be producing
"GPL-2.0-or-later", rather than "GPL-2".

I did try pointing the perl debugger at that, but I'm afraid that all that
revealed was that it's a very long time since I tried to debug any perl :-/

My totally unfounded guess would be that something is finding a match on
'GPL-2.0' and stopping, when it should either continue, or preferably have first
checked for a match for the whole string including the '-or-later'

In case it helps to have the real example to look at, the file that was
misidentified is here:

https://salsa.debian.org/debian/openqa/-/blob/debian/latest/t/43-cli-api.t?ref_type=heads#L2

and you can see that misidentification here:

https://dfsg-new-queue.debian.org/reviews/openqa-server

HTH

Cheers, Phil.