diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:42:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:42:30 +0000 |
commit | 75808db17caf8b960b351e3408e74142f4c85aac (patch) | |
tree | 7989e9c09a4240248bf4658a22208a0a52d991c4 /t/recipes/checks/binaries/corrupted | |
parent | Initial commit. (diff) | |
download | lintian-upstream.tar.xz lintian-upstream.zip |
Adding upstream version 2.117.0.upstream/2.117.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/recipes/checks/binaries/corrupted')
19 files changed, 307 insertions, 0 deletions
diff --git a/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/dumpobj b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/dumpobj new file mode 100644 index 0000000..afdf68e --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/dumpobj @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +DEB_BUILD_GNU_TYPE="$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)" + +case $DEB_BUILD_GNU_TYPE in +i486-linux-gnu|i586-linux-gnu|i686-linux-gnu|x86_64-linux-gnu) + base64 -d <<DATA +f0VMRgEBAQAAAAAAAAAAAAIAKAABAAAAMIEAADQAAAA4bwkAAgAABDQAIAAGACgAGwAaAAEAAHDY +WgkA2NoJANjaCQBQCgAAUAoAAAQAAAAEAAAAAQAAAAAAAAAAgAAAAIAAAKhlCQCoZQkABQAAAACA +AAABAAAAqGUJAKhlCgCoZQoAIAgAAOwlAAAGAAAAAIAAAAQAAAD0AAAA9IAAAPSAAAAgAAAAIAAA +AAQAAAAEAAAABwAAAKhlCQCoZQoAqGUKABgAAAAwAAAABAAAAAQAAABR5XRkAAAAAAAAAAAAAAAA +AAAAAAAAAAAGAAAABAAAAAQAAAAQAAAAAQAAAEdOVQAAAAAAAgAAAAYAAAASAAAABOAt5QTQTeIR +AADrBNCN4gTgneQe/y/hAAAAACTAn+UAsKDjBBCd5A0goOEEIC3lBAAt5RAAn+UQMJ/lBMAt5dwS +DATA + ;; +*) + base64 -d <<DATA +f0VMRgEBMAAwMDAwMDAwMAIAAwABAAAA +DATA + ;; +esac diff --git a/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/install b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/install new file mode 100644 index 0000000..369fa72 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/install @@ -0,0 +1,2 @@ +debian/elfobject usr/bin/ +debian/fake-guile-object.go usr/lib/foo/binaries-from-other-arch/guile/2.2/ diff --git a/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/rules b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/rules new file mode 100755 index 0000000..60907d2 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +DEB_BUILD_OPTIONS := nostrip +export DEB_BUILD_OPTIONS + +%: + dh $@ + +binary: + sh debian/dumpobj > debian/elfobject + sh debian/dumpobj > debian/fake-guile-object.go + dh binary diff --git a/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/fill-values b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/fill-values new file mode 100644 index 0000000..d765ecd --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/build-spec/fill-values @@ -0,0 +1,6 @@ +Skeleton: upload-native +Testname: binaries-from-other-arch +Package-Architecture: any +Dh-Compat-Level: 10 +Description: Test package with a pseudo binary from a different architecture +# since debhelper 12.5.2, objdump no longer fails silently for compat > 10, need better binary diff --git a/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/eval/desc b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/eval/desc new file mode 100644 index 0000000..65502f9 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/eval/desc @@ -0,0 +1,4 @@ +Testname: binaries-from-other-arch +Test-Architectures: amd64 i386 +Check: binaries/corrupted +# since debhelper 12.5.2, objdump no longer fails silently for compat > 10, need better binary diff --git a/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/eval/hints b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/eval/hints new file mode 100644 index 0000000..54909bb --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/binaries-from-other-arch/eval/hints @@ -0,0 +1,4 @@ +binaries-from-other-arch (binary): elf-error In ELF header: Section headers are not available! [usr/lib/foo/binaries-from-other-arch/guile/2.2/fake-guile-object.go] +binaries-from-other-arch (binary): elf-error In ELF header: Section headers are not available! [usr/bin/elfobject] +binaries-from-other-arch (binary): elf-error In ELF header: Reading 1080 bytes extends past end of file for section headers [usr/lib/foo/binaries-from-other-arch/guile/2.2/fake-guile-object.go] +binaries-from-other-arch (binary): elf-error In ELF header: Reading 1080 bytes extends past end of file for section headers [usr/bin/elfobject] diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/_symbols b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/_symbols new file mode 100644 index 0000000..46e6af1 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/_symbols @@ -0,0 +1,23 @@ + This line should flag a syntax error +# but this one shouldn't +| although this one should, but for a different reason + and so should this + +libhello.so.0 libhello0 #MINVER# +| libhello0c2 (>= 1.2) , libhelloc0c2 (<< 1.3) +| hello-dbg3| libhelloc0c3|foobar (= 1.2) |hello-dbg2 +| hello-dbg + hello@Base 1.0 +* Build-Dep-Foo: bar + hello2@Base 2.0 4 + hello3@Base 2.0 1 + hello3@Base 2.0 A + dummy + +libhello.so.2 libhello2 #MINVER# +* Build-Depends-Package: libbar +| libhello2 (>= 1:2.3) + hello@Base 2.0 + +libhello.so.0 libhello0 #MINVER# + duplicate@Base 1.0 diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/changelog.in b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/changelog.in new file mode 100644 index 0000000..02da925 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/changelog.in @@ -0,0 +1,13 @@ +debug ([% $version %]) [% $distribution %]; urgency=low + + * NMU. + (uploaded by the maintainer and with repeated version number) + + -- Russ Allbery <rra@debian.org> Tue, 4 Apr 2006 20:27:22 +0000 + +debug (1.0) unstable; urgency=low + + * Initial version. + + -- Russ Allbery <rra@debian.org> Sat, 4 Mar 2006 21:31:06 -0800 + diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/compat.in b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/compat.in new file mode 100644 index 0000000..640a566 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/compat.in @@ -0,0 +1 @@ +[% $dh_compat_level %] diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/control b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/control new file mode 100644 index 0000000..fcb2b86 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/control @@ -0,0 +1,85 @@ +Source: debug +Section: utils +Priority: optional +Maintainer: Russ Allbery <rra@debian.org> +Build-Depends: debhelper (>= 5.0.0) +Build-Depends-Indep: not-debhelper (>= 0.4.3) +Standards-Version: 3.7.0 + +Package: hello +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Test for external debugging information + Lintian regression test for external debugging file handling. This test + contains the binary. + . + 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 + things. It should not be installed like a regular package. + +Package: hello-dbg +Priority: optional +Section: debug +Architecture: any +Depends: hello (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Test for external debugging information (symbols) + Lintian regression test for external debugging file handling. This test + contains the binary symbols. + . + 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 + things. It should not be installed like a regular package. + +Package: libhello0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Test for external debugging information (library) + Lintian regression test for external debugging file handling. This test + contains a library. + . + 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 + things. It should not be installed like a regular package. + +Package: libhello0-dbg +Section: debug +Priority: optional +Architecture: any +Depends: libhello (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Test for external debugging information (library symbols) + Lintian regression test for external debugging file handling. This test + contains the library symbols. + . + 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 + things. It should not be installed like a regular package. + +Package: hi-dbg +Section: debug +Priority: optional +Architecture: any +Depends: foo-pkg, not-libhello0 +Description: Test for external debugging symbols + Lintian regression test for external debugging files handling. This test + contains the library symbols. + . + 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 + things. It should not be installed like a regular package. It may + be an empty package. + +Package: hello-hello-dbg +Section: debug +Priority: optional +Architecture: any +Depends: foo-pkg, not-libhello0, hello +Description: Test for external debugging symbols - another try + Lintian regression test for external debugging files handling. This test + contains the library symbols. This package actually tests a combination of + the above. + . + 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 + things. It should not be installed like a regular package. It may + be an empty package. diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/copyright b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/copyright new file mode 100644 index 0000000..5d4f6c2 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/copyright @@ -0,0 +1,4 @@ +Written Sat, 04 Mar 2006 21:30:01 -0800 by Russ Allbery <rra@debian.org>. + +Test for copyright in capital letters. (#464992) +COPYRIGHT RUSS ALLBERY 2006 diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/rules b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/rules new file mode 100755 index 0000000..b659895 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/debian/rules @@ -0,0 +1,99 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# This file is public domain software, originally written by Joey Hess. + +# turn off PIE in CC in case we have a PIEful toolchain: +ifneq ($(findstring -no-pie,$(shell gcc -no-pie 2>&1)),) + CC := gcc +else + CC := gcc -fno-pie -no-pie +endif + +build-indep: + +build-arch: build-stamp + +build-stamp: + dh_testdir + $(CC) -D_REENTRANT -fPIC -c libhello.c + $(CC) -o libhello.so.0.0 -shared -Wl,-soname,libhello.so.0 libhello.o + ln -s libhello.so.0.0 libhello.so + $(CC) -o hello hello.c -L. -lhello + touch build-stamp + +build: build-arch build-indep + +clean: + dh_testdir + dh_testroot + rm -f build-stamp *.o libhello.so.0.0 libhello.so + dh_clean + +install: build-stamp + dh_testdir + dh_testroot + dh_clean -k + install -D hello $(CURDIR)/debian/hello/usr/bin/hello + install -D libhello.so.0.0 \ + $(CURDIR)/debian/libhello0/usr/lib/libhello.so.0.0 + ln -s libhello.so.0.0 \ + $(CURDIR)/debian/libhello0/usr/lib/libhello.so.0 + +# Build architecture-dependent files here. +export DH_OPTIONS +binary-arch: DH_OPTIONS=-a +binary-arch: build-stamp install + dh_testdir + dh_testroot + dh_installchangelogs -N hello-dbg + dh_installdocs + DH_OPTIONS= dh_strip -phello --dbg-package=hello-dbg + DH_OPTIONS= dh_strip -plibhello0 --dbg-package=libhello0-dbg + + # Now break a few things. Copy the debugging data into places it + # shouldn't be. + cp $(CURDIR)/debian/hello-dbg/usr/lib/debug/usr/bin/hello \ + $(CURDIR)/debian/hello/usr/bin/hello.dbg + cp $(CURDIR)/debian/libhello0-dbg/usr/lib/debug/usr/lib/libhello.so.0.0 \ + $(CURDIR)/debian/libhello0-dbg/usr/lib/libhello.so.dbg + + # Put a full copy of the library in libhello0-dbg in /usr/lib/debug, + # which is okay. + install -m 644 libhello.so.0.0 \ + $(CURDIR)/debian/libhello0-dbg/usr/lib/debug/libhello.so.0.0 + + # Also put it in /usr/lib/debug/lib, which isn't. + install -D -m 644 libhello.so.0.0 \ + $(CURDIR)/debian/libhello0-dbg/usr/lib/debug/lib/libhello.so.0.0 + + # Requires a versioned dependency. + dh_icons + + dh_link + dh_compress + dh_fixperms + dh_makeshlibs -X debug + dh_installdeb + dh_shlibdeps -X debug + + # We do this by hand as otherwise dpkg-gensymbols + # will error due to the broken symbols file + # and abort the build; similarly the file in + # the source tree is _symbols so that dpkg + # doesn't attempt to sanity check it + install -d $(CURDIR)/debian/libhello0/DEBIAN + install -m 644 $(CURDIR)/debian/_symbols \ + $(CURDIR)/debian/libhello0/DEBIAN/symbols + # hello doesn't contain any shlibs, but we + # make it contain a symbols file + install -d $(CURDIR)/debian/hello/DEBIAN + install -m 644 $(CURDIR)/debian/_symbols \ + $(CURDIR)/debian/hello/DEBIAN/symbols + + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-indep: +binary: binary-indep binary-arch +.PHONY: build-arch build-indep build binary binary-indep binary-arch clean install diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/fill-values b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/fill-values new file mode 100644 index 0000000..e2f713c --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/fill-values @@ -0,0 +1,8 @@ +Skeleton: upload-native +Testname: legacy-debug +Source: debug +Default-Build-Depends: + debhelper (>= 9.20151004~), + binutils (>= 2.37.50.20211102) +Dh-Compat-Level: 7 +Description: Legacy test "debug" diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/hello.c b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/hello.c new file mode 100644 index 0000000..76f8337 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/hello.c @@ -0,0 +1,9 @@ +#include <stdlib.h> +#include "libhello.h" + +int +main(void) +{ + hello(); + exit(0); +} diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/libhello.c b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/libhello.c new file mode 100644 index 0000000..e2f8409 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/libhello.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void +hello(void) +{ + printf("Hello, World!\n"); +} diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/libhello.h b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/libhello.h new file mode 100644 index 0000000..ef77476 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/build-spec/orig/libhello.h @@ -0,0 +1 @@ +void hello(void); diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/eval/desc b/t/recipes/checks/binaries/corrupted/legacy-debug/eval/desc new file mode 100644 index 0000000..a55c905 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/eval/desc @@ -0,0 +1,2 @@ +Testname: legacy-debug +Check: binaries/corrupted diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/eval/hints b/t/recipes/checks/binaries/corrupted/legacy-debug/eval/hints new file mode 100644 index 0000000..0b0b081 --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/eval/hints @@ -0,0 +1,3 @@ +libhello0-dbg (binary): binary-with-bad-dynamic-table [usr/lib/libhello.so.dbg] +hello (binary): binary-with-bad-dynamic-table [usr/bin/hello.dbg] +hello (binary): elf-error In program headers: Unable to find program interpreter name [usr/bin/hello.dbg] diff --git a/t/recipes/checks/binaries/corrupted/legacy-debug/eval/post-test b/t/recipes/checks/binaries/corrupted/legacy-debug/eval/post-test new file mode 100644 index 0000000..fc97c5f --- /dev/null +++ b/t/recipes/checks/binaries/corrupted/legacy-debug/eval/post-test @@ -0,0 +1,2 @@ +/: hardening-.*/ d +s/\(current is ([0-9]+\.)+[0-9]\)/(current is CURRENT)/ |