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/files/debug | |
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 '')
27 files changed, 307 insertions, 0 deletions
diff --git a/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/control.in b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/control.in new file mode 100644 index 0000000..8f83518 --- /dev/null +++ b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/control.in @@ -0,0 +1,26 @@ +Source: [% $source %] +Section: [% $section %] +Priority: optional +Maintainer: [% $author %] +Standards-Version: [% $standards_version %] +Build-Depends: [% $build_depends %] +Rules-Requires-Root: no + +Package: [% $source %] +Architecture: [% $package_architecture %] +Depends: ${shlibs:Depends}, ${misc: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 + things. It should not be installed like a regular package. It may + be an empty package. + +Package: [% $source %]-dbgsym +Section: debug +Architecture: all +Depends: [% $source %], ${shlibs:Depends}, ${misc:Depends} +Description: Fake dbgsym package + 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 + even be an empty package. diff --git a/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/non-debug-file-in-debug-package-dbgsym.install b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/non-debug-file-in-debug-package-dbgsym.install new file mode 100644 index 0000000..9f11a1a --- /dev/null +++ b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/non-debug-file-in-debug-package-dbgsym.install @@ -0,0 +1 @@ +foo / diff --git a/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/rules b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/rules new file mode 100755 index 0000000..e3b452e --- /dev/null +++ b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_gencontrol: + # Pretend this is a real debug package. + dh_gencontrol -- -Dauto-built-package=debug-symbols diff --git a/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/fill-values b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/fill-values new file mode 100644 index 0000000..e967840 --- /dev/null +++ b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/fill-values @@ -0,0 +1,4 @@ +Skeleton: upload-native +Testname: non-debug-file-in-debug-package +Package-Architecture: any +Description: Test for -dbgsym packages with non-.debug files diff --git a/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/orig/foo b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/orig/foo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/build-spec/orig/foo diff --git a/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/eval/desc b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/eval/desc new file mode 100644 index 0000000..61c2f05 --- /dev/null +++ b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/eval/desc @@ -0,0 +1,2 @@ +Testname: non-debug-file-in-debug-package +Check: files/debug-packages diff --git a/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/eval/hints b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/eval/hints new file mode 100644 index 0000000..a48226b --- /dev/null +++ b/t/recipes/checks/files/debug-packages/non-debug-file-in-debug-package/eval/hints @@ -0,0 +1,3 @@ +non-debug-file-in-debug-package-dbgsym (binary): non-debug-file-in-debug-package [usr/share/doc/non-debug-file-in-debug-package-dbgsym/copyright] +non-debug-file-in-debug-package-dbgsym (binary): non-debug-file-in-debug-package [usr/share/doc/non-debug-file-in-debug-package-dbgsym/changelog.gz] +non-debug-file-in-debug-package-dbgsym (binary): non-debug-file-in-debug-package [foo] diff --git a/t/recipes/checks/files/debug/binaries-general/build-spec/debian/rules b/t/recipes/checks/files/debug/binaries-general/build-spec/debian/rules new file mode 100644 index 0000000..3ea7a63 --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/build-spec/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + +%: + dh $@ + +override_dh_strip: + dh_strip -X usr/lib/debug -X unstripped -X ocaml + +override_dh_dwz: + # Can error with "deadbeefdeadbeef.debug: Found compressed .debug_info section, not attempting dwz compression" diff --git a/t/recipes/checks/files/debug/binaries-general/build-spec/fill-values b/t/recipes/checks/files/debug/binaries-general/build-spec/fill-values new file mode 100644 index 0000000..a24247d --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/build-spec/fill-values @@ -0,0 +1,4 @@ +Skeleton: upload-native +Testname: binaries-general +Description: Misc errors related to binaries +Package-Architecture: any diff --git a/t/recipes/checks/files/debug/binaries-general/build-spec/orig/Makefile b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/Makefile new file mode 100644 index 0000000..cf0f211 --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/Makefile @@ -0,0 +1,64 @@ +# 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 + +NOPIE_CFLAGS = $(filter-out -fPIE,$(CFLAGS)) +NOPIE_LDFLAGS = $(filter-out -fPIE -pie,$(LDFLAGS)) +COMPILE:= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) +COMPILE_NOPIE:= $(CC) $(NOPIE_CFLAGS) $(CPPFLAGS) $(NOPIE_LDFLAGS) +# extract from readelf +GETBUILDID:=./getbuildid + +all: + # rpath not matching any of the exceptions to the rpath checks + # - with profiling enabled. + $(COMPILE_NOPIE) -o basic basic.c -pg -Wl,--rpath,/usr/local/lib + # rpath shipped in the package, but one of {/usr}?/lib + $(COMPILE) -o basiclibrpath basic.c -Wl,--rpath,/usr/lib + # non-special rpath shipped in the package + $(COMPILE) -o basicshippedrpath basic.c -Wl,--rpath,/usr/share/foo + # special rpath shipped in the package, multiple paths + $(COMPILE) -o basicshippedrpathmore basic.c -Wl,--rpath,/usr/lib/binaries-general:/usr/lib/binaries-general/bar + # static version of basic for debugging checks + $(COMPILE_NOPIE) -static -o basic.static basic.c + # static executable to trigger ocaml check + $(COMPILE_NOPIE) -o ocaml-exec ocaml.c + # version with debug + $(COMPILE) -o basicdebug -g3 -Wl,--build-id basic.c + +install: + # according to local debian rules /usr/lib/debug is unstripped + install -d $(DESTDIR)/usr/share/foo/ + install -d $(DESTDIR)/usr/lib/debug/usr/share/foo/ + install -d $(DESTDIR)/usr/lib/foo/ + install -d $(DESTDIR)/usr/bin + + install -m 755 -c basic $(DESTDIR)/usr/share/foo/basic + objcopy --only-keep-debug basic $(DESTDIR)/usr/lib/debug/usr/share/foo/basic + strip -s $(DESTDIR)/usr/lib/debug/usr/share/foo/basic + install -m 755 -c basiclibrpath $(DESTDIR)/usr/lib/foo/basiclibrpath + install -m 755 -c basicshippedrpath $(DESTDIR)/usr/lib/foo/basicshippedrpath + install -m 755 -c ocaml-exec $(DESTDIR)/usr/lib/foo/ocaml-exec + install -m 744 -c basicshippedrpathmore $(DESTDIR)/usr/lib/foo/basicshippedrpathmore + objcopy --only-keep-debug basic $(DESTDIR)/usr/lib/debug/basic + install -d "$(DESTDIR)/usr/lib/debug/.build-id/"`$(GETBUILDID) -s basicdebug` + install -m 755 -c basicdebug $(DESTDIR)/usr/share/foo/basicdebug + # force fake buildid in order to have tag matching ok (deadbeefdeadbeef) + install -d "$(DESTDIR)/usr/lib/debug/.build-id/de" + objcopy --compress-debug-sections basicdebug \ + "$(DESTDIR)/usr/lib/debug/.build-id/de/deadbeefdeadbeef.debug" + install -d "$(DESTDIR)/usr/lib/debug/.build-id/"`$(GETBUILDID) -s basicdebug` + objcopy --compress-debug-sections --only-keep-debug basicdebug \ + "$(DESTDIR)/usr/lib/debug/.build-id/"`$(GETBUILDID) -s basicdebug`"/"`$(GETBUILDID) -f basicdebug`.debug + install -m 755 -c basic.static $(DESTDIR)/usr/lib/debug/ + # according to local debian rules unstripped in name avoid dh_strip to do the work + install -m 755 basicdebug $(DESTDIR)/usr/bin/unstripped + install -m 755 basic.static $(DESTDIR)/usr/bin/static + +clean distclean: + rm -f basic + +check test: diff --git a/t/recipes/checks/files/debug/binaries-general/build-spec/orig/basic.c b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/basic.c new file mode 100644 index 0000000..3618004 --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/basic.c @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <string.h> + +int +main(int argc, char *argv[]) +{ + char t[10]; + printf("Hello world!\n"); + /* forces a stack protector */ + (void) strcpy(t,argv[0]); + return (int) t[0]; +} diff --git a/t/recipes/checks/files/debug/binaries-general/build-spec/orig/getbuildid b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/getbuildid new file mode 100755 index 0000000..0060d2b --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/getbuildid @@ -0,0 +1,30 @@ +#!/bin/sh +# get build-id of binary + +set -e + +usage() { + echo "Usage: getbuildid [flag] file"; + echo " print build-id of an object file" + echo "flags:" + echo " -f : full build-id (default)." + echo " -s : short build-id aka the first two characters." +} + +if test $# -lt 1; then usage; exit 77; fi +if test $# -gt 3; then usage; exit 77; fi + +if test $# -eq 1; then + LC_ALL=C readelf -n "$1" | grep -i 'Build Id:' | sed 's/.*:[[:blank:]]*\([[:digit:]|abcdef]*\).*/\1/g' +else + case "x$1" in + 'x-f') + LC_ALL=C readelf -n "$2" | grep -i 'Build Id:' | sed 's/.*:[[:blank:]]*\([[:digit:]|abcdef]*\).*/\1/g' ;; + 'x-s') + LC_ALL=C readelf -n "$2" | grep -i 'Build Id:' | sed 's/.*:[[:blank:]]*\([[:digit:]|abcdef]\{2\}\).*/\1/g' ;; + *) + exit 2; + esac +fi + +exit 0; diff --git a/t/recipes/checks/files/debug/binaries-general/build-spec/orig/ocaml.c b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/ocaml.c new file mode 100644 index 0000000..370d17d --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/build-spec/orig/ocaml.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +int +main(int argc, char **argv) +{ + if (argc > 2) { + puts("Caml1999X000"); + } + puts("\n"); + return 0; +} diff --git a/t/recipes/checks/files/debug/binaries-general/eval/desc b/t/recipes/checks/files/debug/binaries-general/eval/desc new file mode 100644 index 0000000..e0ff32f --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/eval/desc @@ -0,0 +1,2 @@ +Testname: binaries-general +Check: files/debug diff --git a/t/recipes/checks/files/debug/binaries-general/eval/hints b/t/recipes/checks/files/debug/binaries-general/eval/hints new file mode 100644 index 0000000..e6af89d --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/eval/hints @@ -0,0 +1 @@ +binaries-general (binary): debug-suffix-not-dbg [usr/lib/debug/.build-id/] diff --git a/t/recipes/checks/files/debug/binaries-general/eval/post-test b/t/recipes/checks/files/debug/binaries-general/eval/post-test new file mode 100755 index 0000000..11ad2c8 --- /dev/null +++ b/t/recipes/checks/files/debug/binaries-general/eval/post-test @@ -0,0 +1 @@ +/: hardening-.*/ d diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/clean b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/clean new file mode 100644 index 0000000..be4ae72 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/clean @@ -0,0 +1,5 @@ +bar.1* +Bar.pm +bar.png +perllocal.pod +preferences diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/dirs b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/dirs new file mode 100644 index 0000000..e8759c9 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/dirs @@ -0,0 +1,15 @@ +etc/apt/preferences.d +etc/apt +etc/init +bin/foo +mnt/foo +tmp/foo +usr/bin/foo +usr/foo +usr/lib/debug +usr/local/foo +usr/lib/site-python/foo +usr/share/doc/files-foo-in-bar/examples/examples +var/foo +var/lock/foo +var/run/foo diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/install b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/install new file mode 100644 index 0000000..ba46865 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/install @@ -0,0 +1,61 @@ +bar bin/foo +bar emul +bar etc/apt/preferences.d +bar etc/apt/sources.list.d +bar etc/apt/trusted.gpg.d +bar etc/gconf/schemas/ +bar etc/init +bar etc/rc.boot +bar etc/rc.d +bar etc/udev/rules.d +bar lib32 +bar lib64 +bar libx32 +bar mnt/foo +bar run/foo +bar srv/foo +bar tmp/foo +bar usr/bin/foo +bar usr/foo +bar usr/lib/debug/ +bar usr/lib32 +bar usr/lib64 +bar usr/libexec +bar usr/libx32 +bar usr/lib/perl/ +bar usr/lib/python2.7/ +bar usr/lib/sgml +bar usr/lib/site-python/foo +bar usr/local/foo +bar usr/share +bar usr/share/doc +bar usr/share/doc/files-foo-in-bar/.xvpics/ +bar usr/share/doc/files-foo-in-bar/.thumbnails/ +bar usr/share/doc/files-foo-in-bar/examples/examples +bar usr/share/mime/foo/ +bar usr/share/mime/packages/ +bar usr/share/perl/ +bar usr/share/vim/vimcurrent/ +bar usr/share/vim/vim73/ +bar usr/X11R6/bin +bar usr/X11R6/lib/X11/fonts/ +bar var/foo +bar var/lock/foo +bar var/run/foo +bar var/www/foo +bar home/johndoe +bar root +bar etc/opt +bar var/cache/pbuilder/build +bar var/lib/sbuild +bar var/lib/buildd +bar build/dir/foo +bar tmp/buildd/dir/foo +bar etc/dhcp3 + +Bar.pm usr/lib/perl5/Foo +bar.png usr/lib/files-foo-in-bar + +perllocal.pod usr/lib/perl-foo +.packlist usr/lib/perl5 +preferences etc/apt diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/manpages b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/manpages new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/manpages diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/rules b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/rules new file mode 100755 index 0000000..69a61df --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f +%: + dh $@ + +override_dh_auto_build: + pod2man --section 1 bar.pod > bar.1 + gzip -n --best bar.1 + cp bar Bar.pm + cp bar bar.png + cp bar perllocal.pod + touch .packlist + touch preferences + +override_dh_auto_install: + dh_install bar.1.gz usr/X11R6/man/man1/ + +# skip +override_dh_usrlocal override_dh_gconf: diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/fill-values b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/fill-values new file mode 100644 index 0000000..17ea927 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: files-foo-in-bar +Description: Test tags about files or dirs in given paths diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/orig/bar b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/orig/bar new file mode 100644 index 0000000..980a0d5 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/orig/bar @@ -0,0 +1 @@ +Hello World! diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/orig/bar.pod b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/orig/bar.pod new file mode 100644 index 0000000..4144a36 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/build-spec/orig/bar.pod @@ -0,0 +1,18 @@ + +=head1 NAME + +bar - does stuff + +=head1 SYNOPSIS + +bar + +=head1 DESCRIPTION + +Does nothing. + +=head1 AUTHOR + +Niels Thykier <niels@thykier.net> + +=cut diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/eval/desc b/t/recipes/checks/files/debug/files-foo-in-bar/eval/desc new file mode 100644 index 0000000..34f3664 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/eval/desc @@ -0,0 +1,2 @@ +Testname: files-foo-in-bar +Check: files/debug diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/eval/hints b/t/recipes/checks/files/debug/files-foo-in-bar/eval/hints new file mode 100644 index 0000000..b957aef --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/eval/hints @@ -0,0 +1 @@ +files-foo-in-bar (binary): debug-suffix-not-dbg [usr/lib/debug/bar] diff --git a/t/recipes/checks/files/debug/files-foo-in-bar/eval/post-test b/t/recipes/checks/files/debug/files-foo-in-bar/eval/post-test new file mode 100644 index 0000000..5af7ea2 --- /dev/null +++ b/t/recipes/checks/files/debug/files-foo-in-bar/eval/post-test @@ -0,0 +1,2 @@ +# Ignore all duplicate-files tags +/[^ ]* \([^)]*\): duplicate-files .*/ d |