[SCM] Debian package checker branch, master, updated. 2.5.11-83-g263ef90
The following commit has been merged in the master branch:
commit 263ef9028153c9dc0fd3f9fef1a687d45ac89646
Author: Niels Thykier <niels@thykier.net>
Date: Fri Jan 18 23:49:26 2013 +0100
c/binaries: detect binaries built without LFS
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/binaries b/checks/binaries
index 7681c8b..a390298 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -82,6 +82,9 @@ sub _split_hash {
}
our $HARDENING = Lintian::Data->new ('binaries/hardening-tags', qr/\s*\|\|\s*/o, \&_split_hash);
+our $LFS_SYMBOLS = Lintian::Data->new ('binaries/lfs-symbols');
+
+our $ARCH_32_REGEX;
sub run {
@@ -109,6 +112,12 @@ my $srcpkg = $proc->pkg_src;
foreach my $file (sort keys %{$info->objdump_info}) {
my $objdump = $info->objdump_info->{$file};
+ my $has_lfs = undef;
+ # Only 32bit ELF binaries can lack LFS.
+ $ARCH_32_REGEX = $ARCH_REGEX->value ('32') unless defined $ARCH_32_REGEX;
+ $has_lfs = 1 unless $info->file_info ($file) =~ m/$ARCH_32_REGEX/o;
+ # We don't care if it is a debug file
+ $has_lfs = 1 if $file =~ m,^usr/lib/debug/,;
if (defined $objdump->{SONAME}) {
foreach my $soname (@{$objdump->{SONAME}}) {
@@ -118,6 +127,20 @@ foreach my $file (sort keys %{$info->objdump_info}) {
}
foreach my $symbol (@{$objdump->{SYMBOLS}}) {
my ($foo, $sec, $sym) = @{$symbol};
+
+ unless ($has_lfs) {
+ if ($LFS_SYMBOLS->known ($sym)) {
+ # Using a 32bit only interface call, assume it is
+ # built without LFS (for now). We may disapprove this
+ # later if a 64 variant comes along.
+ $has_lfs = 0;
+ } elsif ($sym =~ m/^(.+)64$/) {
+ # all LFS symbols appear to be end with 64; exploit
+ # that to check if LFS is enabled.
+ my $base = $1;
+ $has_lfs = 1 if $LFS_SYMBOLS->known ($base);
+ }
+ }
if ($arch ne 'hppa') {
if ($foo eq '.text' and $sec eq 'Base' and
$sym eq '__gmon_start__') {
@@ -131,6 +154,8 @@ foreach my $file (sort keys %{$info->objdump_info}) {
}
tag 'binary-file-compressed-with-upx', $file if $objdump->{'UPX'};
tag 'apparently-corrupted-elf-binary', $file if $objdump->{'ERRORS'};
+ tag 'binary-file-built-without-LFS-support', $file
+ if defined $has_lfs and not $has_lfs;
if ($objdump->{'BAD-DYNAMIC-TABLE'}) {
tag 'binary-with-bad-dynamic-table', $file unless $file =~ m%^usr/lib/debug/%;
}
diff --git a/checks/binaries.desc b/checks/binaries.desc
index decb548..d24e045 100644
--- a/checks/binaries.desc
+++ b/checks/binaries.desc
@@ -343,3 +343,16 @@ Info: The binary is installed as a detached "debug symbols" ELF file,
.
Implementation detail: Lintian currently checks for the ".debug_line"
section, which is a part of the DWARF standard.
+
+Tag: binary-file-built-without-LFS-support
+Severity: minor
+Certainty: possible
+Experimental: yes
+Info: The listed ELF binary appears to be built without "Large File
+ Support" (LFS). If so, it may not be able to handle large files
+ correctly.
+ .
+ To support large files, ensure that <tt>_FILE_OFFSET_BITS</tt> is
+ defined and set to 64 before the relevant files are included. This
+ can be done by using the <tt>AC_SYS_LARGEFILE</tt> macro with
+ autoconf.
diff --git a/data/binaries/lfs-symbols b/data/binaries/lfs-symbols
new file mode 100644
index 0000000..b39cf61
--- /dev/null
+++ b/data/binaries/lfs-symbols
@@ -0,0 +1,64 @@
+# Manually maintained table of non-lfs and lfs symbols
+#
+# Maps a non-lfs symbol (_FILE_OFFSET_BITS=32) to its "large-file"
+# variant. List was found by grepping around in /usr/include on an
+# i386 system with build-essential installed
+#
+# Please keep this sorted by key.
+
+aio_cancel
+aio_error
+aio_fsync
+aio_read
+aio_return
+aio_suspend
+aio_write
+alphasort
+creat
+fallocate
+fgetpos
+fopen
+freopen
+fseeko
+fsetpos
+fstat
+fstatat
+fstatfs
+fstatvfs
+ftello
+ftruncate
+ftw
+getdirentries
+getrlimit
+glob
+globfree
+lio_listio
+lockf
+lseek
+lstat
+mkostemp
+mkostemps
+mkstemp
+mkstemps
+mmap
+nftw
+open
+openat
+posix_fadvise
+posix_fallocate
+pread
+preadv
+prlimit
+pwrite
+pwritev
+readdir
+readdir_r
+scandir
+sendfile
+setrlimit
+stat
+statfs
+statvfs
+tmpfile
+truncate
+versionsort
diff --git a/debian/changelog b/debian/changelog
index 0788d9a..e840219 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ lintian (2.5.12) UNRELEASED; urgency=low
* Summary of tag changes:
+ Added:
- ambiguous-paragraph-in-dep5-copyright
+ - binary-file-built-without-LFS-support
- debug-file-with-no-debug-symbols
- desktop-entry-lacks-keywords-entry
- dir-or-file-in-build-tree
@@ -23,6 +24,10 @@ lintian (2.5.12) UNRELEASED; urgency=low
+ [NT] Detect debug ELF binaries with no debug symbols.
Thanks to Nelson A. de Oliveira for the report.
(Closes: #668437)
+ + [NT] Check for binaries built without LFS. This can
+ only be checked for 32bit binaries as 64bit binaries
+ have LFS by definition. Thanks to Guillem Jover for
+ the report. (Closes: #670963)
* checks/cruft:
+ [NT] Do not emit the license-problem-json-evil tag for
non-free packages.
diff --git a/t/tests/binaries-missing-depends-on-libc/debian/Makefile b/t/tests/binaries-missing-lfs/debian/Makefile
similarity index 100%
copy from t/tests/binaries-missing-depends-on-libc/debian/Makefile
copy to t/tests/binaries-missing-lfs/debian/Makefile
diff --git a/t/tests/binaries-missing-depends-on-libc/debian/basic.c b/t/tests/binaries-missing-lfs/debian/basic.c
similarity index 67%
copy from t/tests/binaries-missing-depends-on-libc/debian/basic.c
copy to t/tests/binaries-missing-lfs/debian/basic.c
index 7bdd01c..ebc0e17 100644
--- a/t/tests/binaries-missing-depends-on-libc/debian/basic.c
+++ b/t/tests/binaries-missing-lfs/debian/basic.c
@@ -1,4 +1,8 @@
#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
static void
hardening_trigger(char *p, int i, void (*f)(char *))
@@ -15,3 +19,8 @@ lib_interface(void)
printf("Hello world!\n");
hardening_trigger(NULL, 0, NULL);
}
+
+int
+do_open (char *file) {
+ return open (file, O_RDONLY);
+}
diff --git a/t/tests/binaries-missing-depends/debian/debian/control.in b/t/tests/binaries-missing-lfs/debian/debian/control.in
similarity index 90%
copy from t/tests/binaries-missing-depends/debian/debian/control.in
copy to t/tests/binaries-missing-lfs/debian/debian/control.in
index b8dc8de..d8f6688 100644
--- a/t/tests/binaries-missing-depends/debian/debian/control.in
+++ b/t/tests/binaries-missing-lfs/debian/debian/control.in
@@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 9), perl
Package: libbasic2
Architecture: any
-Depends: $\{misc:Depends\}, $\{shlib:Depends\}
+Depends: $\{misc:Depends\}, $\{shlibs:Depends\}
Description: {$description}
This is a test package designed to exercise some feature or tag of
Lintian. It is part of the Lintian test suite and may do very odd
diff --git a/t/tests/binaries-missing-depends-on-libc/debian/debian/libbasic2.symbols b/t/tests/binaries-missing-lfs/debian/debian/libbasic2.symbols
similarity index 76%
copy from t/tests/binaries-missing-depends-on-libc/debian/debian/libbasic2.symbols
copy to t/tests/binaries-missing-lfs/debian/debian/libbasic2.symbols
index c2b8fb3..b072f19 100644
--- a/t/tests/binaries-missing-depends-on-libc/debian/debian/libbasic2.symbols
+++ b/t/tests/binaries-missing-lfs/debian/debian/libbasic2.symbols
@@ -1,2 +1,3 @@
libbasic.so.2 libbasic2 #MINVER#
+ do_open@Base 1.0
lib_interface@Base 1.0
diff --git a/t/tests/binaries-missing-lfs/desc b/t/tests/binaries-missing-lfs/desc
new file mode 100644
index 0000000..9dc8dad
--- /dev/null
+++ b/t/tests/binaries-missing-lfs/desc
@@ -0,0 +1,6 @@
+Testname: binaries-missing-lfs
+Sequence: 6000
+Version: 1.0
+Description: Test for missing lfs
+Architecture: i386
+Test-For: binary-file-built-without-LFS-support
diff --git a/t/tests/binaries-missing-lfs/tags b/t/tests/binaries-missing-lfs/tags
new file mode 100644
index 0000000..fd377b0
--- /dev/null
+++ b/t/tests/binaries-missing-lfs/tags
@@ -0,0 +1 @@
+X: libbasic2: binary-file-built-without-LFS-support usr/lib/libbasic.so.2
--
Debian package checker
Reply to: