Bug#795614: [PATCH] fix false-positive spelling-error-in-binary affecting many Go binaries

2015-08-16 Thread Niels Thykier
On 2015-08-15 21:59, Michael Stapelberg wrote:
 Package: lintian
 Version: 2.5.33
 Severity: normal
 Tags: patch
 
From the patch description:
  [PATCH] spelling-error-in-binary: ignore ang/and
  
  The Go stdlib html/ package contains the string ang; (for the ang;
  entity). Every program which directly or indirectly imports the html/
  package will hence end up with an unuseful spelling-error-in-binary
  lintian warning.
 
 [...]

Hi Michael,

Thanks for the patch.

I was wondering, have you tried something like?


$ git diff
diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index 4b08fae..0b11477 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -301,6 +301,7 @@ sub check_spelling {
 $text =~ s/(\w-)\s*\n\s*/$1/;
 $text =~ tr/\r\n \t/ /s;
 $text =~ s/\s++/ /g;
+$text =~ s/\[a-zA-Z0-9_-]+\;//g; # Ignore XML entities
 strip($text);

 for my $word (split(' ', $text)) {


AFAICT, it should strip out all XML entities (untested though), which
should be a more generic solution.  Does this work for you?

Thanks,
~Niels



Bug#795614: [PATCH] fix false-positive spelling-error-in-binary affecting many Go binaries

2015-08-16 Thread Michael Stapelberg
On Sun, Aug 16, 2015 at 10:11 AM, Niels Thykier ni...@thykier.net wrote:
 On 2015-08-15 21:59, Michael Stapelberg wrote:
 Package: lintian
 Version: 2.5.33
 Severity: normal
 Tags: patch

From the patch description:
  [PATCH] spelling-error-in-binary: ignore ang/and

  The Go stdlib html/ package contains the string ang; (for the ang;
  entity). Every program which directly or indirectly imports the html/
  package will hence end up with an unuseful spelling-error-in-binary
  lintian warning.

 [...]

 Hi Michael,

 Thanks for the patch.

 I was wondering, have you tried something like?

 
 $ git diff
 diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
 index 4b08fae..0b11477 100644
 --- a/lib/Lintian/Check.pm
 +++ b/lib/Lintian/Check.pm
 @@ -301,6 +301,7 @@ sub check_spelling {
  $text =~ s/(\w-)\s*\n\s*/$1/;
  $text =~ tr/\r\n \t/ /s;
  $text =~ s/\s++/ /g;
 +$text =~ s/\[a-zA-Z0-9_-]+\;//g; # Ignore XML entities
  strip($text);

  for my $word (split(' ', $text)) {
 

 AFAICT, it should strip out all XML entities (untested though), which
 should be a more generic solution.  Does this work for you?

I think your patch does indeed strip out XML entities, but it doesn’t
quite work for our use-case: note that the string that’s found in the
binary is “ang;”, not “ang;”.

-- 
Best regards,
Michael



Bug#795614: [PATCH] fix false-positive spelling-error-in-binary affecting many Go binaries

2015-08-15 Thread Michael Stapelberg
Package: lintian
Version: 2.5.33
Severity: normal
Tags: patch

From the patch description:
 [PATCH] spelling-error-in-binary: ignore ang/and
 
 The Go stdlib html/ package contains the string ang; (for the ang;
 entity). Every program which directly or indirectly imports the html/
 package will hence end up with an unuseful spelling-error-in-binary
 lintian warning.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.0.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages lintian depends on:
ii  binutils   2.25-10
ii  bzip2  1.0.6-8
ii  diffstat   1.58-1
ii  file   1:5.22+15-2
ii  gettext0.19.4-1
ii  hardening-includes 2.7
ii  intltool-debian0.35.0+20060710.2
ii  libapt-pkg-perl0.1.29+b2
ii  libarchive-zip-perl1.48-1
ii  libclass-accessor-perl 0.34-1
ii  libclone-perl  0.38-1
ii  libdpkg-perl   1.18.1
ii  libemail-valid-perl1.196-1
ii  libfile-basedir-perl   0.07-1
ii  libipc-run-perl0.94-1
ii  liblist-moreutils-perl 0.413-1
ii  libparse-debianchangelog-perl  1.2.0-4
ii  libtext-levenshtein-perl   0.12-1
ii  libtimedate-perl   2.3000-2
ii  liburi-perl1.64-1
ii  man-db 2.7.0.2-5
ii  patchutils 0.3.4-1
ii  perl [libdigest-sha-perl]  5.20.2-6
ii  t1utils1.38-4
ii  xz-utils   5.1.1alpha+20120614-2.1

Versions of packages lintian recommends:
ii  dpkg1.18.1
pn  libperlio-gzip-perl none
ii  perl5.20.2-6
ii  perl-modules [libautodie-perl]  5.20.2-6

Versions of packages lintian suggests:
pn  binutils-multiarch none
ii  dpkg-dev   1.18.1
ii  libhtml-parser-perl3.71-2
ii  libtext-template-perl  1.46-1
pn  libyaml-perl   none

-- no debconf information
From 9e94af4f6d4bc0169fd3de6073707e4ce4e94c04 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg stapelb...@debian.org
Date: Sat, 15 Aug 2015 21:54:16 +0200
Subject: [PATCH] spelling-error-in-binary: ignore ang/and

The Go stdlib html/ package contains the string ang; (for the ang;
entity). Every program which directly or indirectly imports the html/
package will hence end up with an unuseful spelling-error-in-binary
lintian warning.
---
 checks/binaries.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/checks/binaries.pm b/checks/binaries.pm
index 94197b6..1ad6282 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -364,6 +364,7 @@ sub run {
 'teH' = 1, # From #711207
 'tEH' = 1, # From #782902
 'tEh' = 1, # From #782902, too
+'ang' = 1, # The Go stdlib html/ package contains ang;
 };
 my $tag_emitter
   = spelling_tag_emitter('spelling-error-in-binary', $file);
-- 
2.1.4