tags 673352 patch thanks Attaching a patch series that fixes this bug, bug #673862 and has some other enhancements for icon-size-and-directory-name-mismatch.
>From fc75c5737d3ba4b068d4255b207dfae058cc106c Mon Sep 17 00:00:00 2001 From: Felix Geyer <debfx-...@fobos.de> Date: Tue, 15 May 2012 12:13:43 +0200 Subject: [PATCH 1/4] Exclude animations from icon-size-and-directory-name-mismatch check. They contain the icon for each frame so naturally are larger than the directory name size. --- checks/files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checks/files b/checks/files index e99fa41..70d62a1 100644 --- a/checks/files +++ b/checks/files @@ -918,7 +918,7 @@ foreach my $file (@{$info->sorted_index}) { tag 'python-module-in-wrong-location', @correction if (@correction); } - if ($file =~ m,/icons/[^/]+/(\d+x\d+)/.*\.png$,) { + if ($file =~ m,/icons/[^/]+/(\d+x\d+)/(?!animations/).*\.png$,) { my ($dsize, $fsize) = ($1); $info->file_info->{$file} =~ m/,\s*(\d+)\s*x\s*(\d+)\s*,/; $fsize = $1.'x'.$2; -- 1.7.9.5
>From 494c7017484eec690906ad341534d4c712c627f1 Mon Sep 17 00:00:00 2001 From: Felix Geyer <debfx-...@fobos.de> Date: Wed, 23 May 2012 14:22:44 +0200 Subject: [PATCH 2/4] Don't emit invalid icon-size-and-directory-name-mismatch tags for symlinks. Check if file_info exists for the file and matches the regular expression. --- checks/files | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/checks/files b/checks/files index 70d62a1..3a340a7 100644 --- a/checks/files +++ b/checks/files @@ -919,11 +919,13 @@ foreach my $file (@{$info->sorted_index}) { } if ($file =~ m,/icons/[^/]+/(\d+x\d+)/(?!animations/).*\.png$,) { - my ($dsize, $fsize) = ($1); - $info->file_info->{$file} =~ m/,\s*(\d+)\s*x\s*(\d+)\s*,/; - $fsize = $1.'x'.$2; - tag 'icon-size-and-directory-name-mismatch', $file, $fsize - unless ($dsize eq $fsize); + my $dsize = $1; + my $fileinfo = $info->file_info->{$file}; + if ($fileinfo && $fileinfo =~ m/,\s*(\d+)\s*x\s*(\d+)\s*,/) { + my $fsize = $1.'x'.$2; + tag 'icon-size-and-directory-name-mismatch', $file, $fsize + unless ($dsize eq $fsize); + } } if ($file =~ m,/icons/[^/]+/scalable/.*\.(?:png|xpm)$,) { -- 1.7.9.5
>From 0ef4aad048e7722a277e6e4a325ee636f75a7d87 Mon Sep 17 00:00:00 2001 From: Felix Geyer <debfx-...@fobos.de> Date: Wed, 23 May 2012 14:41:00 +0200 Subject: [PATCH 3/4] Check icon-size-and-directory-name-mismatch for symlinks within a package. --- checks/files | 10 ++++++++-- t/tests/files-general/debian/debian/links | 1 + t/tests/files-general/tags | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 t/tests/files-general/debian/debian/links diff --git a/checks/files b/checks/files index 3a340a7..71a4232 100644 --- a/checks/files +++ b/checks/files @@ -26,7 +26,7 @@ use File::Basename; use Lintian::Data; use Lintian::Tags qw(tag); -use Lintian::Util qw(fail); +use Lintian::Util qw(fail resolve_pkg_path); my $FONT_PACKAGES = Lintian::Data->new ('files/fonts', qr/\s++/); my $TRIPLETS = Lintian::Data->new ('files/triplets', qr/\s++/); @@ -920,7 +920,13 @@ foreach my $file (@{$info->sorted_index}) { if ($file =~ m,/icons/[^/]+/(\d+x\d+)/(?!animations/).*\.png$,) { my $dsize = $1; - my $fileinfo = $info->file_info->{$file}; + my $path; + if ($index_info->{type} =~ m/^l/) { + $path = resolve_pkg_path(dirname($file), $link); + } else { + $path = $file; + } + my $fileinfo = $info->file_info->{$path}; if ($fileinfo && $fileinfo =~ m/,\s*(\d+)\s*x\s*(\d+)\s*,/) { my $fsize = $1.'x'.$2; tag 'icon-size-and-directory-name-mismatch', $file, $fsize diff --git a/t/tests/files-general/debian/debian/links b/t/tests/files-general/debian/debian/links new file mode 100644 index 0000000..f3e425d --- /dev/null +++ b/t/tests/files-general/debian/debian/links @@ -0,0 +1 @@ +usr/share/apps/lintian/icons/hicolor/22x22/lintian-22x22.png usr/share/apps/lintian/icons/hicolor/64x64/lintian-64x64.png diff --git a/t/tests/files-general/tags b/t/tests/files-general/tags index 329a24c..c49b862 100644 --- a/t/tests/files-general/tags +++ b/t/tests/files-general/tags @@ -19,6 +19,7 @@ W: files-general: executable-not-elf-or-script usr/share/man/man5/foo.5.gz W: files-general: file-in-unusual-dir new-top-level-dir/file-in-new-top-level-dir W: files-general: file-name-ends-in-whitespace usr/share/foo/ws W: files-general: icon-size-and-directory-name-mismatch usr/share/apps/lintian/icons/hicolor/22x22/lintian-16x16.png 16x16 +W: files-general: icon-size-and-directory-name-mismatch usr/share/apps/lintian/icons/hicolor/64x64/lintian-64x64.png 22x22 W: files-general: icon-size-and-directory-name-mismatch usr/share/icons/hicolor/22x22/apps/lintian-16x16.png 16x16 W: files-general: obsolete-comments-style-in-php-ini etc/php5/conf.d/php-foo.ini W: files-general: raster-image-in-scalable-directory usr/share/icons/hicolor/scalable/apps/lintian-16x16.png -- 1.7.9.5
>From 1a14b7b10939bab814e61d887241fcaffa17beee Mon Sep 17 00:00:00 2001 From: Felix Geyer <debfx-...@fobos.de> Date: Wed, 23 May 2012 14:57:18 +0200 Subject: [PATCH 4/4] Only emit icon-size-and-directory-name-mismatch if the size differs by more than 2px. --- checks/files | 12 +++++++----- t/tests/files-general/debian/debian/install | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/checks/files b/checks/files index 71a4232..a801adf 100644 --- a/checks/files +++ b/checks/files @@ -918,8 +918,8 @@ foreach my $file (@{$info->sorted_index}) { tag 'python-module-in-wrong-location', @correction if (@correction); } - if ($file =~ m,/icons/[^/]+/(\d+x\d+)/(?!animations/).*\.png$,) { - my $dsize = $1; + if ($file =~ m,/icons/[^/]+/(\d+)x(\d+)/(?!animations/).*\.png$,) { + my ($dwidth, $dheight) = ($1, $2); my $path; if ($index_info->{type} =~ m/^l/) { $path = resolve_pkg_path(dirname($file), $link); @@ -928,9 +928,11 @@ foreach my $file (@{$info->sorted_index}) { } my $fileinfo = $info->file_info->{$path}; if ($fileinfo && $fileinfo =~ m/,\s*(\d+)\s*x\s*(\d+)\s*,/) { - my $fsize = $1.'x'.$2; - tag 'icon-size-and-directory-name-mismatch', $file, $fsize - unless ($dsize eq $fsize); + my ($fwidth, $fheight) = ($1, $2); + my $width_delta = abs($dwidth - $fwidth); + my $height_delta = abs($dheight - $fheight); + tag 'icon-size-and-directory-name-mismatch', $file, $fwidth.'x'.$fheight + unless ($width_delta <= 2 && $height_delta <= 2); } } diff --git a/t/tests/files-general/debian/debian/install b/t/tests/files-general/debian/debian/install index 4ce9d68..4b2bbb1 100644 --- a/t/tests/files-general/debian/debian/install +++ b/t/tests/files-general/debian/debian/install @@ -1,6 +1,7 @@ lintian-16x16.png usr/share/apps/lintian/icons/hicolor/22x22 lintian-16x16.png usr/share/icons/hicolor/22x22/apps lintian-22x22.png usr/share/apps/lintian/icons/hicolor/22x22 +lintian-22x22.png usr/share/apps/lintian/icons/hicolor/20x20 lintian-16x16.png usr/share/doc/lintian/ lintian-22x22.png usr/share/games/icons/hicolor/22x22 lintian-16x16.png usr/share/icons/hicolor/scalable/apps -- 1.7.9.5