Bug#867302: licensecheck: incorrectly parses multi-line copyright notices

Ximin Luo infinity0 at debian.org
Wed Jul 5 16:23:00 UTC 2017


Control: tags -1 + patch
Control: reassign -1 libstring-copyright-perl
Control: affects -1 + licensecheck

Looks like I can do this by editing /usr/share/perl5/String/Copyright.pm as follows:

 		# stringify objects
 		$copyright = "$copyright";
+		$copyright =~ s/(,|\band)\s*\n(?:#|\/\/|\/\*)?\s*/$1 /g;

Please test and apply if it's good!

X

Ximin Luo:
> Package: licensecheck
> Version: 3.0.29-1
> Severity: normal
> 
> Dear Maintainer,
> 
> For https://sources.debian.net/src/sagemath/7.6-2/sage/src/sage/misc/edit_module.py/
> 
> $ licensecheck --copyright src/sage/misc/edit_module.py 
> src/sage/misc/edit_module.py: GPL
>   [Copyright: 2007 Nils Bruin <nbruin at sfu.ca> and]
> 
> This is wrong, but I can work around it with the following sed script:
> 
> $ cat src/sage/misc/edit_module.py | tr '\n' '\t' | sed -e 's/\(,\|\band\)\s*\t#\?\s*/\1 /g' | tr '\t' '\n' > fixed.py
> $ licensecheck --copyright fixed.py 
> fixed.py: GPL
>   [Copyright: 2007 Nils Bruin <nbruin at sfu.ca> and William Stein <wstein at math.ucsd.edu>]
> 
> It would be good if this logic were incorporated into licensecheck itself. I'd
> help, but my perl is really bad.
> 
> (Also perhaps the # in the regex should be a (?:#|//|/*) or something like that)
> 
> X
> 
> -- System Information:
> Debian Release: 9.0
>   APT prefers testing
>   APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'buildd-unstable'), (300, 'unstable'), (100, 'experimental'), (1, 'experimental-debug')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
> 
> Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
> Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> 
> Versions of packages licensecheck depends on:
> ii  libgetopt-long-descriptive-perl           0.100-1
> ii  libmoo-perl                               2.003002-1
> ii  libnamespace-clean-perl                   0.27-1
> ii  libpath-iterator-rule-perl                1.009-1
> ii  libpath-tiny-perl                         0.100-1
> ii  libpod-constants-perl                     0.19-1
> ii  libscalar-list-utils-perl                 1:1.47-1
> ii  libsort-key-perl                          1.33-1+b3
> ii  libstrictures-perl                        2.000003-1
> ii  libstring-copyright-perl                  0.003005-1
> ii  libstring-escape-perl                     2010.002-1
> ii  libtry-tiny-perl                          0.28-1
> ii  perl                                      5.24.1-4
> ii  perl-base [libscalar-list-utils-perl]     5.24.1-4
> ii  perl-modules-5.24 [libexperimental-perl]  5.24.1-4
> 
> Versions of packages licensecheck recommends:
> ii  bash-completion  1:2.1-4.3
> 
> licensecheck suggests no packages.
> 
> -- no debconf information
> 


-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git



More information about the pkg-perl-maintainers mailing list