Subject: Bug#1000319: lintian should provide an error when Debian::Copyright fails

From: Yadd <[email-masked]>
Date: Sun, 21 Nov 2021 14:23:17 +0100

Package: lintian
Version: 2.111.0
Severity: wishlist

Hi Felix,

lintian should provide an error when Debian::Copyright fails and
debian/copyright declares to be compatible with
https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Example with salsa.debian.org/js-team/uglifyjs

Cheers,
Yadd

---

From: Felix Lechner <[email-masked]>
Date: Sun, 21 Nov 2021 08:28:33 -0800

Hi Yadd,

On Sun, Nov 21, 2021 at 5:27 AM Yadd <[email-masked]> wrote:
>
> lintian should provide an error when Debian::Copyright fails

Which failure did you have in mind, please? Lintian parses
machine-readable files—which is what uglifyjs ships [1]—in the nearby
check Debian::Copyright::Dep5. [2] Thanks!

Kind regards
Felix Lechner

[1] https://tracker.debian.org/media/packages/u/uglifyjs/copyright-2.8.29-8
[2] https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debian/Copyright/Dep5.pm

---

From: Yadd <[email-masked]>
Date: Sun, 21 Nov 2021 18:08:41 +0100

> check Debian::Copyright::Dep5. [2] Thanks!

I wrote some scripts which use Debian::Copyright to automatize some JS
things, but when Debian::Copyright is unable to read debian/copyright,
automatic tools fail.

Here is a simple test:

  my $c = Debian::Copyright->new();
  $c->read('debian/copyright');

---

From: Felix Lechner <[email-masked]>
Date: Sun, 21 Nov 2021 09:35:02 -0800

Hi,

On Sun, Nov 21, 2021 at 9:08 AM Yadd <[email-masked]> wrote:
>
> I wrote some scripts which use Debian::Copyright

Sorry, I did not realize you were referring to functionality provided
by libdebian-copyright-perl.

If you are just extracting information—Lintian does the validation—you
may be better off using a better parser. I could upload mine to the
archive, if you would like to try it. [1] For starters, field names
are case-insensitive (a requirement of the Deb822 spec). There are
also many field extraction functions, such as '->trimmed_list' [2]
(with an optional separator). The way to check for the presence of a
field is with '->declares'. [3] Most significantly, there are no NULL
pointers. [4]

It would be a little bit of a philosophical stretch for Lintian to
alert users to problems with other parsers, rather than the document
itself.

Kind regards
Felix Lechner

[1] Plus two surrounding files,
https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Deb822/Section.pm
[2] https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Team/PkgJs/Testsuite.pm#L55-56
[3] https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debian/Copyright/Dep5.pm#L404-408
[4] https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare/