Package: lintian Version: 2.5.15 Severity: wishlist Tags: patch File: /usr/share/lintian/checks/infofiles.pm
This is an idea to notice when /usr/share/info/foo.info contains an image like [image src="filename.png"] but the target .png is not in the package. Images can be displayed by emacs, if the png files are present. Current packages with this problem include bison-doc, gdb-doc, gri, and libforms-dev. The .png files should exist in the source dist, since makeinfo demands a png for @image{} in the .texi. So fixing a missing .png in the deb should be as simple as copying into the package, or mangling the src="" to the right place if the png is in the package but somewhere else.
--- infofiles.pm.orig 2013-08-11 12:29:28.000000000 +1000 +++ infofiles.pm 2013-08-11 14:30:53.000000000 +1000 @@ -25,7 +25,7 @@ use autodie; use Lintian::Tags qw(tag); -use Lintian::Util qw(fail open_gz); +use Lintian::Util qw(fail open_gz normalize_pkg_path); use File::Basename qw(fileparse); @@ -92,6 +92,32 @@ tag 'info-document-missing-dir-section', $file unless $section; tag 'info-document-missing-dir-entry', $file unless $start && $end; } + + # Check each [image src=""] form in the info files. The src filename + # should be in the package. As of Texinfo 5 it will be something.png or + # something.jpg, but that's not enforced. + # + # See Texinfo manual (info "(texinfo)Info Format Image") for details of + # the [image] form. Bytes \x00,\x08 introduce it (and distinguishes it + # from [image] appearing as plain text). + # + # String src="..." part has \" for literal " and \\ for literal \, + # though that would be unlikely in filenames. For the tag() message + # show $src unbackslashed since that's the filename sought. + # + if ($file->is_file && $fname =~ /\.info(-\d+)?\.gz$/) { + my $fd = open_gz($info->unpacked($file)); + local $_; + while (<$fd>) { + while (/[\0][\b]\[image src="((\\.|[^\"])+)"/g) { + my $src = $1; + $src =~ s/\\(.)/$1/g; # unbackslash + $info->index(normalize_pkg_path('/usr/share/info',$src)) + or tag 'info-document-missing-image-file', $file, $src; + } + } + close($fd); + } } return;
--- infofiles.desc.orig 2013-08-11 12:29:24.000000000 +1000 +++ infofiles.desc 2013-08-11 15:07:02.000000000 +1000 @@ -61,3 +61,19 @@ appropriate entry. You will have to ensure that the build process builds new info files rather than using ones built by upstream. +Tag: info-document-missing-image-file +Severity: normal +Certainty: certain +Info: This info document contains an "[image]" but the image file it + specifies is missing. Texinfo <tt>@image{}</tt> becomes <tt>[image + src="filename.png"]</tt> in the <tt>.info</tt>. Emacs 22 and up info + mode can display this on a GUI if filename.png is in + <tt>/usr/share/info</tt> or if the src gives a path to the file + elsewhere. + . + If you put an image file in <tt>/usr/share/info</tt> then please name + it like the document so as to avoid name clashes. Eg. foo.info might + call an image foo-example1.png. If upstream doesn't do this already + then it may be easier to <tt>sed</tt> the <tt>src=""</tt> to a path + elsewhere, perhaps to share with a HTML rendition under say + <tt>/usr/share/doc/foo/html/</tt>.
-- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (990, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.32-5-486 Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/dash Versions of packages lintian depends on: ii binutils 2.21.51.20110421-3 ii bzip2 1.0.6-4 ii diffstat 1.55-3 ii file 1:5.14-2 ii gettext 0.18.3-1 ii hardening-includes 2.3 ii intltool-debian 0.35.0+20060710.1 ii libapt-pkg-perl 0.1.29 ii libarchive-zip-perl 1.30-7 ii libclass-accessor-perl 0.34-1 ii libclone-perl 0.34-1 ii libdigest-sha-perl 5.85-1 ii libdpkg-perl 1.16.10 ii libemail-valid-perl 0.190-1 ii libfile-basedir-perl 0.03-1 ii libipc-run-perl 0.92-1 ii liblist-moreutils-perl 0.33-1+b1 ii libparse-debianchangelog-perl 1.2.0-1 ii libtext-levenshtein-perl 0.06~01-2 ii libtimedate-perl 1.2000-1 ii liburi-perl 1.60-1 ii man-db 2.6.5-2 ii patchutils 0.3.2-2 ii perl [libdigest-sha-perl] 5.14.2-21 ii t1utils 1.37-2 Versions of packages lintian recommends: ii libautodie-perl 2.20-1 ii libperlio-gzip-perl 0.18-1+b2 ii perl-modules [libautodie-perl] 5.14.2-21 Versions of packages lintian suggests: pn binutils-multiarch <none> ii dpkg-dev 1.16.10 ii libhtml-parser-perl 3.71-1 ii libtext-template-perl 1.45-2 ii xz-utils 5.1.1alpha+20120614-2 -- no debconf information