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

Bug#718404: marked as done ([PATCH] Don’t generate statically-linked-binary for golang packages)



Your message dated Wed, 21 Aug 2013 11:04:09 +0000
with message-id <E1VC6Cv-0005LP-5H@franck.debian.org>
and subject line Bug#718404: fixed in lintian 2.5.16
has caused the Debian Bug report #718404,
regarding [PATCH] Don’t generate statically-linked-binary for golang packages
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
718404: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718404
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: lintian
Version: 2.5.15
Severity: wishlist
Tags: patch

The attached patch modifies lintian so that it will not generate
statically-linked-binary for every package built with golang-go.

This is preferable to adding override files in every package.
>From 05208d99ddb0afb68ae8affa1a7552231ed6276d Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Wed, 31 Jul 2013 10:28:10 +0200
Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20generate=20statically-linked-bina?=
 =?UTF-8?q?ry=20for=20binary=20packages=20built=20with=20golang-go?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 checks/binaries.pm                            |    8 +++++
 t/tests/binaries-golang/debian/Makefile       |   48 +++++++++++++++++++++++++
 t/tests/binaries-golang/debian/basic.c        |   12 +++++++
 t/tests/binaries-golang/debian/debian/control |   15 ++++++++
 t/tests/binaries-golang/debian/debian/rules   |    7 ++++
 t/tests/binaries-golang/debian/getbuildid     |   30 ++++++++++++++++
 t/tests/binaries-golang/desc                  |   14 ++++++++
 t/tests/binaries-golang/tags                  |   13 +++++++
 8 files changed, 147 insertions(+)
 create mode 100644 t/tests/binaries-golang/debian/Makefile
 create mode 100644 t/tests/binaries-golang/debian/basic.c
 create mode 100644 t/tests/binaries-golang/debian/debian/control
 create mode 100644 t/tests/binaries-golang/debian/debian/rules
 create mode 100755 t/tests/binaries-golang/debian/getbuildid
 create mode 100644 t/tests/binaries-golang/desc
 create mode 100644 t/tests/binaries-golang/tags

diff --git a/checks/binaries.pm b/checks/binaries.pm
index 80f0637..f26e809 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -225,6 +225,12 @@ for my $file ($info->sorted_index) {
     $directories{"/$name"}++;
 }
 
+my $src = $group->get_source_processable();
+my $built_with_golang;
+if (defined($src)) {
+    $built_with_golang = $src->info->relation('build-depends')->implies('golang-go');
+}
+
 # process all files in package
 foreach my $file ($info->sorted_index) {
     my $fileinfo = $info->file_info ($file);
@@ -393,6 +399,8 @@ foreach my $file ($info->sorted_index) {
             next if ($file =~ m%^boot/%);
             next if ($file =~ /[\.-]static$/);
             next if ($pkg =~ /-static$/);
+            # Binaries built by the Go compiler are statically linked by default.
+            next if ($built_with_golang);
             # klibc binaries appear to be static.
             next if (exists $objdump->{INTERP}
                      && $objdump->{INTERP} =~ m,/lib/klibc-\S+\.so,);
diff --git a/t/tests/binaries-golang/debian/Makefile b/t/tests/binaries-golang/debian/Makefile
new file mode 100644
index 0000000..ac5bd0f
--- /dev/null
+++ b/t/tests/binaries-golang/debian/Makefile
@@ -0,0 +1,48 @@
+COMPILE:= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+# extract from readelf
+GETBUILDID:=./getbuildid
+
+all:
+	# rpath not matching any of the exceptions to the rpath checks
+	#  - with profiling enabled.
+	$(COMPILE) -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
+	# static version of basic for debugging checks
+	$(COMPILE) -static -o basic.static basic.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
+	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/tests/binaries-golang/debian/basic.c b/t/tests/binaries-golang/debian/basic.c
new file mode 100644
index 0000000..7dea5a0
--- /dev/null
+++ b/t/tests/binaries-golang/debian/basic.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int
+main(void)
+{
+    char t[10];
+    printf("Hello world!\n");
+    /* Bad choice for reading from stdin, but it forces a stack
+       protector, so meh.
+     */
+    gets (t);
+}
diff --git a/t/tests/binaries-golang/debian/debian/control b/t/tests/binaries-golang/debian/debian/control
new file mode 100644
index 0000000..662285f
--- /dev/null
+++ b/t/tests/binaries-golang/debian/debian/control
@@ -0,0 +1,15 @@
+Source: binaries-golang
+Priority: extra
+Section: devel
+Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
+Standards-Version: 3.9.4
+Build-Depends: debhelper (>= 9), golang-go (>= 2:1.1.1-4)
+
+Package: binaries-golang
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Test golang binaries
+ 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/tests/binaries-golang/debian/debian/rules b/t/tests/binaries-golang/debian/debian/rules
new file mode 100644
index 0000000..37608c2
--- /dev/null
+++ b/t/tests/binaries-golang/debian/debian/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@
+
+override_dh_strip:
+	dh_strip -X usr/lib/debug -X unstripped
diff --git a/t/tests/binaries-golang/debian/getbuildid b/t/tests/binaries-golang/debian/getbuildid
new file mode 100755
index 0000000..0060d2b
--- /dev/null
+++ b/t/tests/binaries-golang/debian/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/tests/binaries-golang/desc b/t/tests/binaries-golang/desc
new file mode 100644
index 0000000..b7ba4de
--- /dev/null
+++ b/t/tests/binaries-golang/desc
@@ -0,0 +1,14 @@
+Testname: binaries-golang
+Sequence: 6000
+Version: 1.0
+Description: Misc errors related to golang binaries
+Architecture: any
+Test-For:
+ arch-dependent-file-in-usr-share
+ binary-compiled-with-profiling-enabled
+ binary-or-shlib-defines-rpath
+ debug-symbols-directly-in-usr-lib-debug
+ debug-file-should-use-detached-symbols
+ debug-file-with-no-debug-symbols
+ library-in-debug-or-profile-should-not-be-stripped
+ unstripped-binary-or-object
diff --git a/t/tests/binaries-golang/tags b/t/tests/binaries-golang/tags
new file mode 100644
index 0000000..3643b63
--- /dev/null
+++ b/t/tests/binaries-golang/tags
@@ -0,0 +1,13 @@
+E: binaries-golang: arch-dependent-file-in-usr-share usr/share/foo/basic
+E: binaries-golang: arch-dependent-file-in-usr-share usr/share/foo/basicdebug
+E: binaries-golang: binary-or-shlib-defines-rpath usr/lib/foo/basiclibrpath /usr/lib
+E: binaries-golang: binary-or-shlib-defines-rpath usr/share/foo/basic /usr/local/lib
+E: binaries-golang: debug-symbols-directly-in-usr-lib-debug usr/lib/debug/basic
+E: binaries-golang: library-in-debug-or-profile-should-not-be-stripped usr/lib/debug/usr/share/foo/basic
+E: binaries-golang: unstripped-binary-or-object usr/bin/unstripped
+W: binaries-golang: binary-compiled-with-profiling-enabled usr/share/foo/basic
+W: binaries-golang: binary-without-manpage usr/bin/static
+W: binaries-golang: binary-without-manpage usr/bin/unstripped
+W: binaries-golang: debug-file-should-use-detached-symbols usr/lib/debug/.build-id/de/deadbeefdeadbeef.debug
+W: binaries-golang: debug-file-with-no-debug-symbols usr/lib/debug/usr/share/foo/basic
+W: binaries-golang: debug-package-should-be-named-dbg usr/lib/debug/.build-id/
-- 
1.7.10.4


--- End Message ---
--- Begin Message ---
Source: lintian
Source-Version: 2.5.16

We believe that the bug you reported is fixed in the latest version of
lintian, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 718404@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Niels Thykier <niels@thykier.net> (supplier of updated lintian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 21 Aug 2013 12:30:07 +0200
Source: lintian
Binary: lintian
Architecture: source all
Version: 2.5.16
Distribution: unstable
Urgency: low
Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
Changed-By: Niels Thykier <niels@thykier.net>
Description: 
 lintian    - Debian package checker
Closes: 539315 637881 679132 690273 708381 711069 713012 717621 717633 718167 718337 718351 718404 718563 718575 718690 718820 718862 719163 719450 719788 720337
Changes: 
 lintian (2.5.16) unstable; urgency=low
 .
   * Summary of tag changes:
     + Added:
       - changelog-is-dh_make-template
       - copyright-should-refer-to-common-license-file-for-apache-2
       - debian-control-repeats-field-name-in-value
       - info-document-missing-image-file
       - license-problem-font-adobe-copyrighted-fragment
       - license-problem-font-adobe-copyrighted-fragment-no-credit
       - missing-dependency-on-libstdc++
       - quilt-patch-using-template-description
     + Removed:
       - dh_pycentral-is-obsolete
       - dh_python-is-obsolete
       - font-adobe-copyrighted-fragment
       - font-adobe-copyrighted-fragment-no-credit
       - init.d-script-call-internal-API
       - missing-dependency-on-python-central
 .
   * checks/apache2.pm:
     + [NT] Fix F-P apache2-deprecated-auth-config for
       "AllowOverride".  Thanks to Jean-Michel Vourgère
       for the report and an initial patch.
       (Closes: #717621)
   * checks/binaries.pm:
     + [NT] Apply patch from Michael Stapelberg to exempt
       golang-go binaries from statically-linked-binary
       tag.  (Closes: #718404)
     + [NT] Permit shared libraries to not link against
       libc as long as they link against libstdc++.  This
       fixes a lot of false positive warnings for some c++
       libraries when the linker (with --as-needed)
       determines that the libc link is superfluous.
       Thanks to Maximiliano Curia for the report.
       (This is a partial fix for #719806)
     + [NT] Add experimental tag for missing dependency
       on libstdc++.
   * checks/changelog-file.{desc,pm}:
     + [BR] Add check for dh-make reminder to insert the
       bug number of the ITP bug.  (Closes: #690273)
   * checks/control-file.{desc,pm}:
     + [BR] Add check for field name being duplicated in
       the value of the field.  (Closes: #711069)
   * checks/copyright-file.{desc,pm}:
     + [BR] Extend check for "reference to compressed
       common-license" to include all current
       common-licenses.
     + [BR] Add check for use of Apache-2.0 in d/copyright
       without references common-licenses.
       (Closes: #713012)
   * checks/cruft.pm:
     + [NT] Skip d/README.Debian and d/README.source when
       checking for non-free licenses.  Mentions here are
       presumably just false-positives.  Thanks to
       Marcelo Jorge Vieira for the report and the initial
       patch.  (Closes: #718575)
   * checks/deb-format.pm:
     + [NT] Apply patch from Guillem Jover to fix a wrong
       tag being emitted on lzma compressed udebs.
       (Closes: #718337)
   * checks/debhelper.{desc,pm}:
     + [NT] Remove tag for dh_pycentral and dh_python being
       obsolete.  Thanks to Luca Falavigna for the report.
       (Closes: #720337)
     + [BR] Fix false-negative in the brace expansion check
       when the comma was next to one of the braces.
       (Closes: #708381)
   * checks/files.{desc,pm}:
     + [NT] Remove tag for missing dependency on
       python-central.  Thanks to Luca Falavigna for the
       report.  (Closes: #718690)
     + [BR] Rename font-adobe-copyrighted-fragment tags.
       (Closes: #718820)
     + [NT] Fix false positive warning about embedded
       feedparser for python3-feedparser.  Thanks to
       Etienne Millon for the report.  (Closes: #719163)
   * checks/infofiles.{desc,pm}:
     + [NT] Apply patches from Kevin Ryde to find info files
       references non-existent images.  (Closes: #719450)
   * checks/init.d.{desc,pm}:
     + [NT] Revert init.d-script-call-internal-API for now.
       Refer to #710559 for more information.
   * checks/patch-systems.{desc,pm}:
     + [BR] Add tag for DEP-3 template descriptions.
       (Closes: #717633)
   * checks/phppear.{desc,pm}:
     + [NT] Apply patch from Mathieu Parent to fix false
       positive missing-pkg-php-tools-addon.  Thanks to
       Thijs Kinkhorst for the report.  (Closes: #718167)
     + [NT] Apply patch form Mathieu Parent to reduce the
       severity of a "composer package" not using
       pkg-php-tools to wishlist.  Thanks to Thijs
       Kinkhorst for the report.  (Closes: #718862)
     + [NT] Apply patch from Vincent Bernat to downgrade
       severity of not using phppear substvars for
       description and synopsis plus explain that they
       should not be used blindly.  Thanks to Mathieu
       Parent for the review of the patch.
       (Closes: #719788)
   * checks/po-debconf.{desc,pm}:
     + [NT] Fix false-positive translated-default-field for
       fields preceded by a "true" Deb822 comment.  Thanks
       to Ron Lee for the report.  (Closes: #637881)
   * checks/scripts.pm:
     + [NT] Stop emitting package-uses-local-diversion for
       calls to dpkg-divert without --package as dpkg 1.16.0
       (Wheezy) handles this case correctly.  Thanks to
       Raphaël Hertzog for the report.  (Closes: #679132)
     + [NT] Apply patch from Vincent Cheng to fix warning
       for executable jar files.  Thanks to Matthew Johnson
       for the report.  (Closes: #539315)
   * checks/systemd.pm:
     + [NT] Apply patch from Stig Sandbeck Mathisen to allow
       systemd files being symlinks to /dev/null.
       (Closes: #718563)
 .
   * debian/changelog:
     + [NT] Correct some older tag summaries to include some
       missing tags in the entry for 2.5.11 and 2.5.12.
   * debian/copyright:
     + [NT] Add Bastien ROUCARIÈS to maintainers (as BR).
 .
   * frontend/lintian:
     + [NT] Move some handling of overrides to Lintian::Tags.
 .
   * lib/Lintian/Processable/Package.pm:
     + [NT] Refuse to process .dsc files that are missing the
       Source field.   This prevents some warnings about using
       undefined values.  Thanks to Guillem Jover for the
       report.  (Closes: #718351)
   * lib/Lintian/Tags.pm:
     + [NT] Take over some handling of overrides from the
       frontend.
   * lib/Lintian/Util.pm:
     + [NT] Fix problem in normalize_pkg_path, where "."-entries
       were not properly filtered out.
 .
   * profiles/debian/ftp-master-auto-reject.profile:
     + [NT] Refresh with new tags.  Thanks to Gregor Herrmann
       for the reminder.
Checksums-Sha1: 
 435b4f940160af0bfe8643000b8142efe8f55764 2573 lintian_2.5.16.dsc
 b267004fce87bae42752ae6ed4fa8b105e08f39c 1249827 lintian_2.5.16.tar.gz
 056a47deb74c79080e20bfd5dc0c6a0f92aeb197 687684 lintian_2.5.16_all.deb
Checksums-Sha256: 
 436389fa459f33539c6afbd6aa3902b4e28162be85199f183a748b0f7dc83cde 2573 lintian_2.5.16.dsc
 961c015a5aefa1e9904e187339ee1d18968ab8205086fa67c419720632dd4ab7 1249827 lintian_2.5.16.tar.gz
 f00462f5608739edbd532fd605d90b632b08d624b4f00440201a0dc7e226882f 687684 lintian_2.5.16_all.deb
Files: 
 8cf3f55588dc60f30efa3ae53bb20b08 2573 devel optional lintian_2.5.16.dsc
 2dbdc658c538dd6c78c9973f57ad662a 1249827 devel optional lintian_2.5.16.tar.gz
 0fe81be17c403f45b54874655e397945 687684 devel optional lintian_2.5.16_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBCAAGBQJSFJz9AAoJEAVLu599gGRC7A4QAJZ2Juj4ZCoGlP0KPAx8H+bs
YRjx+WUMw9bGUUcTmqn+erIMAqHn91J52UBYtMrUX5YjHokZslPtq8qMjT9NLyac
/6r6s4XCiSJOmhZCw6aYeKhlCnttNxzGt1H64lOzRZvWszHb3zbxPE2nDnD6tsWO
9EjZkQCZzORlTVXXQPYE9OgZMmzfAX9cv43cnrunn66Rab3UIfDnzT3wa7DTylWt
cxvuL3SKgkQpQLJ6R3+gfD8NYd+dTQ9fWKLYM5fb0xEMBP9E4CAdcj/seayLyZz8
WH2ufV6H/qsk9qQ8N0P8YPZDv2jchq98D0ZBr7PkS8Qp/w8E3cjN9UaRO65kwl1F
MbMj1N7xjW6pB0vf3hZ+MEfkUbDz8r/Ds7UHzLFPi5JsTHzRE+BC82zow1m7d+rh
dU5KKbglJwnDBY9KbPOIeFyzPJBI2mq5cV3yCBgZA/AL8gedFqKUP5uXdJ7Xs0f/
CvIaanP9gETU0036pCPIZhg+4hDac3zmWEcil5hrSIC5WNT/XXFNc/jVMfk130/O
Fw9tLY+ziCai0UUyWVt/k2dV5UxcFJGj9ZbuNVIAgEryDUrCag+XnhLXkt4hEyIl
T/z5fok4wXME6wOvRLbad7loqq7fleTdLLddbiOYUqiwuo60x6s3XmtXv8XRppKj
/Tv3+utaf5gUqOju1yZl
=roj+
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: