Package: lintian Version: 2.5.1 Severity: normal Tags: patch Hi, First of all, thanks for taking care of Lintian! While hacking on my libdebug package, I found out that Lintian had stopped emitting the shlib-calls-exit tag for some reason. It turned out that the reason was as simple as operator priority and the use of "and" instead of "&&" in the check for a library using "exit" but not "fork". What do you think about the two attached trivial patches - one to add the necessary tests and another to actually fix the problem? :) Once again, thanks for Lintian, and keep up the great work! G'luck, Peter -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (990, 'testing'), (500, 'oldstable'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.39-2-686-pae (SMP w/2 CPU cores) Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages lintian depends on: ii binutils 2.21.52.20110707-1 The GNU assembler, linker and bina ii bzip2 1.0.5-6 high-quality block-sorting file co ii diffstat 1.54-1 produces graph of changes introduc ii file 5.04-5+b1 Determines file type using "magic" ii gettext 0.18.1.1-3 GNU Internationalization utilities ii intltool-debian 0.35.0+20060710.1 Help i18n of RFC822 compliant conf ii libapt-pkg-perl 0.1.24+b2 Perl interface to libapt-pkg ii libclass-accessor-per 0.34-1 Perl module that automatically gen ii libdpkg-perl 1.16.0.3 Dpkg perl modules ii libemail-valid-perl 0.184-1 Perl module for checking the valid ii libipc-run-perl 0.90-1 Perl module for running processes ii libparse-debianchange 1.2.0-1 parse Debian changelogs and output ii libtimedate-perl 1.2000-1 collection of modules to manipulat ii liburi-perl 1.58-1 module to manipulate and access UR ii locales 2.13-7 Embedded GNU C Library: National L ii man-db 2.6.0.2-1 on-line manual pager ii perl [libdigest-sha-p 5.12.4-1 Larry Wall's Practical Extraction ii unzip 6.0-5 De-archiver for .zip files lintian recommends no packages. Versions of packages lintian suggests: ii binutils-multiarch 2.21.52.20110707-1 Binary utilities that support mult ii dpkg-dev 1.16.0.3 Debian package development tools ii libhtml-parser-perl 3.68-1+b1 collection of modules that parse H ii libtext-template-perl 1.45-2 Text::Template perl module ii man-db 2.6.0.2-1 on-line manual pager ii xz-utils 5.0.0-2 XZ-format compression utilities -- no debconf information
From 7f762e222a7d3fd7cefced4a378c0a07c93812fb Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam@ringlet.net>
Date: Fri, 15 Jul 2011 17:50:33 +0300
Subject: [PATCH 1/2] Add two new tests for the shlib-calls-exit tag.
The shared-libs-exit test checks that the shlib-calls-exit tag is
indeed output on a shared library; the shared-libs-exit-fork one
checks that the tag shall *not* be output if fork(2) is also invoked.
---
t/tests/shared-libs-exit-fork/debian/Makefile | 22 ++++++++++++++++++++
t/tests/shared-libs-exit-fork/debian/code.c | 7 ++++++
.../shared-libs-exit-fork/debian/debian/control.in | 14 ++++++++++++
.../debian/debian/libexecbit1.symbols | 2 +
t/tests/shared-libs-exit-fork/debian/debian/rules | 6 +++++
t/tests/shared-libs-exit-fork/desc | 6 +++++
t/tests/shared-libs-exit/debian/Makefile | 22 ++++++++++++++++++++
t/tests/shared-libs-exit/debian/code.c | 5 ++++
t/tests/shared-libs-exit/debian/debian/control.in | 14 ++++++++++++
.../debian/debian/libexecbit1.symbols | 2 +
t/tests/shared-libs-exit/debian/debian/rules | 6 +++++
t/tests/shared-libs-exit/desc | 6 +++++
t/tests/shared-libs-exit/tags | 1 +
13 files changed, 113 insertions(+), 0 deletions(-)
create mode 100644 t/tests/shared-libs-exit-fork/debian/Makefile
create mode 100644 t/tests/shared-libs-exit-fork/debian/code.c
create mode 100644 t/tests/shared-libs-exit-fork/debian/debian/control.in
create mode 100644 t/tests/shared-libs-exit-fork/debian/debian/libexecbit1.symbols
create mode 100644 t/tests/shared-libs-exit-fork/debian/debian/rules
create mode 100644 t/tests/shared-libs-exit-fork/desc
create mode 100644 t/tests/shared-libs-exit-fork/tags
create mode 100644 t/tests/shared-libs-exit/debian/Makefile
create mode 100644 t/tests/shared-libs-exit/debian/code.c
create mode 100644 t/tests/shared-libs-exit/debian/debian/control.in
create mode 100644 t/tests/shared-libs-exit/debian/debian/libexecbit1.symbols
create mode 100644 t/tests/shared-libs-exit/debian/debian/rules
create mode 100644 t/tests/shared-libs-exit/desc
create mode 100644 t/tests/shared-libs-exit/tags
diff --git a/t/tests/shared-libs-exit-fork/debian/Makefile b/t/tests/shared-libs-exit-fork/debian/Makefile
new file mode 100644
index 0000000..02a3474
--- /dev/null
+++ b/t/tests/shared-libs-exit-fork/debian/Makefile
@@ -0,0 +1,22 @@
+CC=gcc
+CFLAGS=-Wall -Winline -O2 -fPIC
+
+SONAMES:= libexecbit.so.1
+LIBFILES:= $(patsubst %,%.0.1, $(SONAMES))
+
+all: $(LIBFILES)
+
+$(LIBFILES): code.o
+ $(CC) -o $@ -shared -Wl,-soname,$(patsubst %.0.1,%,$@) $^ -lc
+
+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-exit-fork/debian/code.c b/t/tests/shared-libs-exit-fork/debian/code.c
new file mode 100644
index 0000000..f593473
--- /dev/null
+++ b/t/tests/shared-libs-exit-fork/debian/code.c
@@ -0,0 +1,7 @@
+#include <stdlib.h>
+#include <unistd.h>
+
+void e(void){
+ if (fork() != 0)
+ exit(1);
+}
diff --git a/t/tests/shared-libs-exit-fork/debian/debian/control.in b/t/tests/shared-libs-exit-fork/debian/debian/control.in
new file mode 100644
index 0000000..8119117
--- /dev/null
+++ b/t/tests/shared-libs-exit-fork/debian/debian/control.in
@@ -0,0 +1,14 @@
+Source: {$srcpkg}
+Priority: extra
+Section: libs
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~)
+
+Package: libexecbit1
+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-exit-fork/debian/debian/libexecbit1.symbols b/t/tests/shared-libs-exit-fork/debian/debian/libexecbit1.symbols
new file mode 100644
index 0000000..0b26833
--- /dev/null
+++ b/t/tests/shared-libs-exit-fork/debian/debian/libexecbit1.symbols
@@ -0,0 +1,2 @@
+libexecbit.so.1 libexecbit1 #MINVER#
+ e@Base 1.0
diff --git a/t/tests/shared-libs-exit-fork/debian/debian/rules b/t/tests/shared-libs-exit-fork/debian/debian/rules
new file mode 100644
index 0000000..c7d497f
--- /dev/null
+++ b/t/tests/shared-libs-exit-fork/debian/debian/rules
@@ -0,0 +1,6 @@
+#!/usr/bin/make -f
+
+DUPSHF:=debian/libdupshf1/DEBIAN/shlibs
+
+%:
+ dh $@
diff --git a/t/tests/shared-libs-exit-fork/desc b/t/tests/shared-libs-exit-fork/desc
new file mode 100644
index 0000000..f5f1b6f
--- /dev/null
+++ b/t/tests/shared-libs-exit-fork/desc
@@ -0,0 +1,6 @@
+Testname: shared-libs-exit-fork
+Sequence: 6000
+Version: 1.0
+Description: Test checks related to libs invoking both exit(3) and fork(2)
+Test-Against:
+ shlib-calls-exit
diff --git a/t/tests/shared-libs-exit-fork/tags b/t/tests/shared-libs-exit-fork/tags
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/shared-libs-exit/debian/Makefile b/t/tests/shared-libs-exit/debian/Makefile
new file mode 100644
index 0000000..02a3474
--- /dev/null
+++ b/t/tests/shared-libs-exit/debian/Makefile
@@ -0,0 +1,22 @@
+CC=gcc
+CFLAGS=-Wall -Winline -O2 -fPIC
+
+SONAMES:= libexecbit.so.1
+LIBFILES:= $(patsubst %,%.0.1, $(SONAMES))
+
+all: $(LIBFILES)
+
+$(LIBFILES): code.o
+ $(CC) -o $@ -shared -Wl,-soname,$(patsubst %.0.1,%,$@) $^ -lc
+
+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-exit/debian/code.c b/t/tests/shared-libs-exit/debian/code.c
new file mode 100644
index 0000000..1ea8589
--- /dev/null
+++ b/t/tests/shared-libs-exit/debian/code.c
@@ -0,0 +1,5 @@
+#include <stdlib.h>
+
+void e(void){
+ exit(1);
+}
diff --git a/t/tests/shared-libs-exit/debian/debian/control.in b/t/tests/shared-libs-exit/debian/debian/control.in
new file mode 100644
index 0000000..8119117
--- /dev/null
+++ b/t/tests/shared-libs-exit/debian/debian/control.in
@@ -0,0 +1,14 @@
+Source: {$srcpkg}
+Priority: extra
+Section: libs
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~)
+
+Package: libexecbit1
+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-exit/debian/debian/libexecbit1.symbols b/t/tests/shared-libs-exit/debian/debian/libexecbit1.symbols
new file mode 100644
index 0000000..0b26833
--- /dev/null
+++ b/t/tests/shared-libs-exit/debian/debian/libexecbit1.symbols
@@ -0,0 +1,2 @@
+libexecbit.so.1 libexecbit1 #MINVER#
+ e@Base 1.0
diff --git a/t/tests/shared-libs-exit/debian/debian/rules b/t/tests/shared-libs-exit/debian/debian/rules
new file mode 100644
index 0000000..c7d497f
--- /dev/null
+++ b/t/tests/shared-libs-exit/debian/debian/rules
@@ -0,0 +1,6 @@
+#!/usr/bin/make -f
+
+DUPSHF:=debian/libdupshf1/DEBIAN/shlibs
+
+%:
+ dh $@
diff --git a/t/tests/shared-libs-exit/desc b/t/tests/shared-libs-exit/desc
new file mode 100644
index 0000000..287be27
--- /dev/null
+++ b/t/tests/shared-libs-exit/desc
@@ -0,0 +1,6 @@
+Testname: shared-libs-exit
+Sequence: 6000
+Version: 1.0
+Description: Test checks related to libs invoking exit(3)
+Test-For:
+ shlib-calls-exit
diff --git a/t/tests/shared-libs-exit/tags b/t/tests/shared-libs-exit/tags
new file mode 100644
index 0000000..16fdc2b
--- /dev/null
+++ b/t/tests/shared-libs-exit/tags
@@ -0,0 +1 @@
+X: libexecbit1: shlib-calls-exit usr/lib/libexecbit.so.1.0.1
--
1.7.5.4
From f69cf6e97da68683ee0f7a5ba2d9e636a44fa6ae Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam@ringlet.net>
Date: Fri, 15 Jul 2011 18:05:52 +0300
Subject: [PATCH 2/2] Fix the logic of the exit/fork check in
shlib-calls-exit.
---
checks/shared-libs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/checks/shared-libs b/checks/shared-libs
index a786a25..4e72ecb 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -107,7 +107,7 @@ for my $cur_file (@{$info->sorted_index}) {
}
my @symbol_names = map { @{$_}[2] } @{$objdump->{$cur_file}->{SYMBOLS}};
- if (grep /^_?exit$/, @symbol_names && !grep $_ eq 'fork', @symbol_names) {
+ if (grep /^_?exit$/, @symbol_names and !grep $_ eq 'fork', @symbol_names) {
tag 'shlib-calls-exit', $cur_file;
}
--
1.7.5.4
Attachment:
signature.asc
Description: Digital signature