[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/03: t: Add test for shared libs without PT_GNU_STACK



This is an automated email from the git hooks/post-receive script.

jwilk pushed a commit to branch master
in repository lintian.

commit e3dc06ae41c38ddbda8e9cfb9a106ae953e75154
Author: Jakub Wilk <jwilk@debian.org>
Date:   Fri Oct 21 20:45:30 2016 +0200

    t: Add test for shared libs without PT_GNU_STACK
---
 t/tests/shared-libs-no-gnu-stack/debian/Makefile   |  23 +++++++++++++++++++++
 t/tests/shared-libs-no-gnu-stack/debian/code.c     |  10 +++++++++
 t/tests/shared-libs-no-gnu-stack/debian/code.o     | Bin 0 -> 1292 bytes
 .../debian/debian/control.in                       |  14 +++++++++++++
 .../debian/debian/libhallo1.symbols                |   2 ++
 .../debian/erase-pt-gnu-stack                      |   9 ++++++++
 .../debian/libhallo.so.1.0.1                       | Bin 0 -> 6952 bytes
 t/tests/shared-libs-no-gnu-stack/desc              |   5 +++++
 t/tests/shared-libs-no-gnu-stack/tags              |   1 +
 9 files changed, 64 insertions(+)

diff --git a/t/tests/shared-libs-no-gnu-stack/debian/Makefile b/t/tests/shared-libs-no-gnu-stack/debian/Makefile
new file mode 100644
index 0000000..8d357a8
--- /dev/null
+++ b/t/tests/shared-libs-no-gnu-stack/debian/Makefile
@@ -0,0 +1,23 @@
+CC=gcc
+CFLAGS+= -fPIC
+
+SONAMES:= libhallo.so.1
+LIBFILES:= $(patsubst %,%.0.1, $(SONAMES))
+
+all: $(LIBFILES)
+
+$(LIBFILES): code.o
+	$(CC) $(LDFLAGS) -fPIC -o $@ -shared -Wl,-soname,$(patsubst %.0.1,%,$@) $^ -lc
+	./erase-pt-gnu-stack $@
+
+clean:
+	rm -f *.a *.o *.so*
+
+install: all
+	install -m 0755 -d $(DESTDIR)/usr/lib
+	install -m 0755 *.so* $(DESTDIR)/usr/lib
+	for FILE in $(SONAMES) ; do \
+	    ln -s $${FILE}.0.1 $(DESTDIR)/usr/lib/$$FILE ; \
+	done
+
+.PHONY: install clean
diff --git a/t/tests/shared-libs-no-gnu-stack/debian/code.c b/t/tests/shared-libs-no-gnu-stack/debian/code.c
new file mode 100644
index 0000000..65887f3
--- /dev/null
+++ b/t/tests/shared-libs-no-gnu-stack/debian/code.c
@@ -0,0 +1,10 @@
+#include <stdlib.h>
+#include <math.h>
+
+double e(void (*f)(char *)){
+  char tmp[10];
+  double x;
+  f(tmp);
+  x = atof(tmp);
+  return exp(x);
+}
diff --git a/t/tests/shared-libs-no-gnu-stack/debian/code.o b/t/tests/shared-libs-no-gnu-stack/debian/code.o
new file mode 100644
index 0000000..5905952
Binary files /dev/null and b/t/tests/shared-libs-no-gnu-stack/debian/code.o differ
diff --git a/t/tests/shared-libs-no-gnu-stack/debian/debian/control.in b/t/tests/shared-libs-no-gnu-stack/debian/debian/control.in
new file mode 100644
index 0000000..a1b78c3
--- /dev/null
+++ b/t/tests/shared-libs-no-gnu-stack/debian/debian/control.in
@@ -0,0 +1,14 @@
+Source: {$source}
+Priority: extra
+Section: libs
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+
+Package: libhallo1
+Architecture: any
+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.
diff --git a/t/tests/shared-libs-no-gnu-stack/debian/debian/libhallo1.symbols b/t/tests/shared-libs-no-gnu-stack/debian/debian/libhallo1.symbols
new file mode 100644
index 0000000..4c27e3f
--- /dev/null
+++ b/t/tests/shared-libs-no-gnu-stack/debian/debian/libhallo1.symbols
@@ -0,0 +1,2 @@
+libhallo.so.1 libhallo1 #MINVER#
+ e@Base 1.0
diff --git a/t/tests/shared-libs-no-gnu-stack/debian/erase-pt-gnu-stack b/t/tests/shared-libs-no-gnu-stack/debian/erase-pt-gnu-stack
new file mode 100755
index 0000000..d3b7e59
--- /dev/null
+++ b/t/tests/shared-libs-no-gnu-stack/debian/erase-pt-gnu-stack
@@ -0,0 +1,9 @@
+#!/usr/bin/perl -pi
+
+use strict;
+use warnings;
+
+my $PT_GNU_STACK = 0x6474e551;
+my $be = pack('L>', $PT_GNU_STACK);
+my $le = pack('L<', $PT_GNU_STACK);
+s/\Q$be\E|\Q$le\E/\0\0\0\0/g;
diff --git a/t/tests/shared-libs-no-gnu-stack/debian/libhallo.so.1.0.1 b/t/tests/shared-libs-no-gnu-stack/debian/libhallo.so.1.0.1
new file mode 100755
index 0000000..b1c4b16
Binary files /dev/null and b/t/tests/shared-libs-no-gnu-stack/debian/libhallo.so.1.0.1 differ
diff --git a/t/tests/shared-libs-no-gnu-stack/desc b/t/tests/shared-libs-no-gnu-stack/desc
new file mode 100644
index 0000000..98d330f
--- /dev/null
+++ b/t/tests/shared-libs-no-gnu-stack/desc
@@ -0,0 +1,5 @@
+Testname: shared-libs-no-gnu-stack
+Version: 1.0
+Test-Depends: debhelper (>= 9.20151004~)
+Description: Test for shared libs without PT_GNU_STACK
+Test-For: shlib-without-PT_GNU_STACK-section
diff --git a/t/tests/shared-libs-no-gnu-stack/tags b/t/tests/shared-libs-no-gnu-stack/tags
new file mode 100644
index 0000000..25f6487
--- /dev/null
+++ b/t/tests/shared-libs-no-gnu-stack/tags
@@ -0,0 +1 @@
+E: libhallo1: shlib-without-PT_GNU_STACK-section usr/lib/libhallo.so.1.0.1

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: