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

Re: Bug#919341: libtool-bin: amd64 /usr/bin/libtool is a zero byte file



Control: severity -1 grave
Control: tag -1 patch

Cyril Brulebois <kibi@debian.org> (2019-01-15):
> For some reasons, libtool and its manpage (from the libtool-bin binary)
> are “sanitized” in binary-indep, which might explain why it's only
> showing up on the maintainer build which was likely using “-b”.
> 
> > $ dpkg-deb -c libtool-bin_2.4.6-7_amd64.deb
> > -rwxr-xr-x root/root         0 2019-01-12 09:10 ./usr/bin/libtool
> > -rw-r--r-- root/root        20 2019-01-12 09:10 ./usr/share/man/man1/libtool.1.gz
> 
> The manpage is a gzipped empty file.

I'm afraid the situation is pretty bad, as an empty executable doesn't
do anything but also produces no errors; so I fear any packages having
been built using this version of libtool-bin on amd64 has likely missed
a step or two without that getting noticed…

Cc-ing debian-release@ & debian-wb-team@ for information.

> At least those points need addressing:
>  1. some sed lines have an extra slash before the repetition specifier.
>  2. the for loop isn't set up to bail out on errors
>  3. libtoolize from bin:libtool which is arch:all is “sanitized”
>     in binary-arch; looks like a mixup between both targets given
>     the already mentioned libtool (binary and manpage)…
>  4. hardcoding the upstream version in debian/rules looks like a recipe
>     for a later regression

I'm attaching individual patches addressing these, along with a ready to
use (except for “dch -r”) source debdiff. A quick upload and further
assessment would likely be a good idea.

Setting up something with autopkgtest might be worth it, if only just to
check a few trivial commands (--help comes to mind).


Cheers,
-- 
Cyril Brulebois (kibi@debian.org)            <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant
From e3c73f4532de8f8f83b242011f536729f4db7b05 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Tue, 15 Jan 2019 03:41:39 +0000
Subject: [PATCH 1/7] Fix Vcs-* URLs.

---
 debian/changelog | 6 ++++++
 debian/control   | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ace7740..4266654 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libtool (2.4.6-8) UNRELEASED; urgency=medium
+
+  * Fix Vcs-* URLs.
+
+ -- Cyril Brulebois <kibi@debian.org>  Tue, 15 Jan 2019 03:41:15 +0000
+
 libtool (2.4.6-7) unstable; urgency=medium
 
   * Standards-Version: 4.3.0
diff --git a/debian/control b/debian/control
index c2cfefc..0d92424 100644
--- a/debian/control
+++ b/debian/control
@@ -17,8 +17,8 @@ Maintainer: Alastair McKinstry <mckinstry@debian.org>
 Standards-Version: 4.3.0
 Rules-Requires-Root: no
 Homepage: https://www.gnu.org/software/libtool/
-Vcs-Browser: https://salsa.debian.org:/mckinstry/libtool.git
-Vcs-Git: https://salsa.debian.org:/mckinstry/libtool.git
+Vcs-Browser: https://salsa.debian.org/mckinstry/libtool.git
+Vcs-Git: https://salsa.debian.org/mckinstry/libtool.git
 
 Package: libtool
 Architecture: all
-- 
2.11.0

From 3849d58d6013a1ae557647335b215a6cfe62d725 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Tue, 15 Jan 2019 03:42:58 +0000
Subject: [PATCH 2/7] Fix sed syntax errors. Closes: #919341

These errors lead to empty libtool executable and manpage. With thanks
to James McCoy for reporting.
---
 debian/changelog | 2 ++
 debian/rules     | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4266654..da983ae 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 libtool (2.4.6-8) UNRELEASED; urgency=medium
 
   * Fix Vcs-* URLs.
+  * Fix sed syntax errors leading to empty libtool executable and
+    manpage, with thanks to James McCoy for reporting. Closes: #919341
 
  -- Cyril Brulebois <kibi@debian.org>  Tue, 15 Jan 2019 03:41:15 +0000
 
diff --git a/debian/rules b/debian/rules
index 004285f..e502a2b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -163,8 +163,8 @@ binary-indep: build-indep install
 	for f in \
 		debian/libtool-bin/usr/share/man/man1/libtool.1 \
 		debian/libtool-bin/usr/bin/libtool ; do cat $$f | \
-			sed -e 's%/usr/bin/grep%/bin/grep%/g' | \
-			sed -e 's%/usr/bin/sed%/bin/sed%/g' | \
+			sed -e 's%/usr/bin/grep%/bin/grep%g' | \
+			sed -e 's%/usr/bin/sed%/bin/sed%g' | \
 			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
 			sed -e 's%${CURDIR}%/build/libtool-2.4.6%g' | \
 			> debian/tmpff ; \
@@ -193,8 +193,8 @@ binary-arch: build-arch install
 	for f in \
 		debian/libtool/usr/bin/libtoolize ; do \
 		cat $$f | \
-			sed -e 's%/usr/bin/grep%/bin/grep%/g' | \
-			sed -e 's%/usr/bin/sed%/bin/sed%/g' | \
+			sed -e 's%/usr/bin/grep%/bin/grep%g' | \
+			sed -e 's%/usr/bin/sed%/bin/sed%g' | \
 			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
 			sed -e 's%${CURDIR}%/build/libtool-2.4.6%g' | \
 			> debian/tmpff ; \
-- 
2.11.0

From 669ed2faf2510b3931cf4a37ca53ba15a8c0598f Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Tue, 15 Jan 2019 03:46:37 +0000
Subject: [PATCH 3/7] Fix sanitation of libtool vs. libtoolize.

The former is shipped in libtool-bin (arch:any, so binary-arch target),
the latter in libtool (arch:all, so binary-indep target).
---
 debian/changelog | 3 +++
 debian/rules     | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index da983ae..b0570fc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ libtool (2.4.6-8) UNRELEASED; urgency=medium
   * Fix Vcs-* URLs.
   * Fix sed syntax errors leading to empty libtool executable and
     manpage, with thanks to James McCoy for reporting. Closes: #919341
+  * Fix sanitation of libtool vs. libtoolize; the former is shipped in
+    libtool-bin (arch:any, so binary-arch target), the latter in libtool
+    (arch:all, so binary-indep target).
 
  -- Cyril Brulebois <kibi@debian.org>  Tue, 15 Jan 2019 03:41:15 +0000
 
diff --git a/debian/rules b/debian/rules
index e502a2b..7190ab9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -161,8 +161,8 @@ binary-indep: build-indep install
 	ln -s ../../misc/config.sub debian/libtool/usr/share/libtool/build-aux
 	# Sanitize /usr-merge path builds
 	for f in \
-		debian/libtool-bin/usr/share/man/man1/libtool.1 \
-		debian/libtool-bin/usr/bin/libtool ; do cat $$f | \
+		debian/libtool/usr/bin/libtoolize ; do \
+		cat $$f | \
 			sed -e 's%/usr/bin/grep%/bin/grep%g' | \
 			sed -e 's%/usr/bin/sed%/bin/sed%g' | \
 			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
@@ -191,8 +191,8 @@ binary-arch: build-arch install
 
 	# Sanitize /usr-merge path builds
 	for f in \
-		debian/libtool/usr/bin/libtoolize ; do \
-		cat $$f | \
+		debian/libtool-bin/usr/share/man/man1/libtool.1 \
+		debian/libtool-bin/usr/bin/libtool ; do cat $$f | \
 			sed -e 's%/usr/bin/grep%/bin/grep%g' | \
 			sed -e 's%/usr/bin/sed%/bin/sed%g' | \
 			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
-- 
2.11.0

From 58692ebdd917a346b2bcf58e8efef1ebef354a6b Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Tue, 15 Jan 2019 05:15:04 +0100
Subject: [PATCH 4/7] Use a single sed call (no pipefail in dash).

---
 debian/rules | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/debian/rules b/debian/rules
index 7190ab9..c9cd055 100755
--- a/debian/rules
+++ b/debian/rules
@@ -161,13 +161,12 @@ binary-indep: build-indep install
 	ln -s ../../misc/config.sub debian/libtool/usr/share/libtool/build-aux
 	# Sanitize /usr-merge path builds
 	for f in \
-		debian/libtool/usr/bin/libtoolize ; do \
-		cat $$f | \
-			sed -e 's%/usr/bin/grep%/bin/grep%g' | \
-			sed -e 's%/usr/bin/sed%/bin/sed%g' | \
-			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
-			sed -e 's%${CURDIR}%/build/libtool-2.4.6%g' | \
-			> debian/tmpff ; \
+		debian/libtool/usr/bin/libtoolize ; do sed \
+			-e 's%/usr/bin/grep%/bin/grep%g' \
+			-e 's%/usr/bin/sed%/bin/sed%g' \
+			-e 's%/usr/bin/dd%/bin/dd%g' \
+			-e 's%${CURDIR}%/build/libtool-2.4.6%g' \
+			$$f > debian/tmpff ; \
 		mv debian/tmpff $$f ; \
 		done
 
@@ -192,12 +191,12 @@ binary-arch: build-arch install
 	# Sanitize /usr-merge path builds
 	for f in \
 		debian/libtool-bin/usr/share/man/man1/libtool.1 \
-		debian/libtool-bin/usr/bin/libtool ; do cat $$f | \
-			sed -e 's%/usr/bin/grep%/bin/grep%g' | \
-			sed -e 's%/usr/bin/sed%/bin/sed%g' | \
-			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
-			sed -e 's%${CURDIR}%/build/libtool-2.4.6%g' | \
-			> debian/tmpff ; \
+		debian/libtool-bin/usr/bin/libtool ; do sed \
+			-e 's%/usr/bin/grep%/bin/grep%g' \
+			-e 's%/usr/bin/sed%/bin/sed%g' \
+			-e 's%/usr/bin/dd%/bin/dd%g' \
+			-e 's%${CURDIR}%/build/libtool-2.4.6%g' \
+			$$f > debian/tmpff ; \
 		mv debian/tmpff $$f ; \
 		done
 
-- 
2.11.0

From a7d3c699fc4136326951fc236841c27b005b8377 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Tue, 15 Jan 2019 05:16:21 +0100
Subject: [PATCH 5/7] Make sure failures are noticed inside for loops.

---
 debian/rules | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/debian/rules b/debian/rules
index c9cd055..675f856 100755
--- a/debian/rules
+++ b/debian/rules
@@ -160,15 +160,15 @@ binary-indep: build-indep install
 	rm -f debian/libtool/usr/share/libtool/build-aux/config.sub
 	ln -s ../../misc/config.sub debian/libtool/usr/share/libtool/build-aux
 	# Sanitize /usr-merge path builds
-	for f in \
+	(set -e; for f in \
 		debian/libtool/usr/bin/libtoolize ; do sed \
 			-e 's%/usr/bin/grep%/bin/grep%g' \
 			-e 's%/usr/bin/sed%/bin/sed%g' \
 			-e 's%/usr/bin/dd%/bin/dd%g' \
 			-e 's%${CURDIR}%/build/libtool-2.4.6%g' \
-			$$f > debian/tmpff ; \
+			$$f > debian/tmpff && \
 		mv debian/tmpff $$f ; \
-		done
+		done)
 
 	dh_installdocs -i
 	dh_installinfo -plibtool-doc
@@ -189,16 +189,16 @@ binary-arch: build-arch install
 	dh_testroot -a
 
 	# Sanitize /usr-merge path builds
-	for f in \
+	(set -e; for f in \
 		debian/libtool-bin/usr/share/man/man1/libtool.1 \
 		debian/libtool-bin/usr/bin/libtool ; do sed \
 			-e 's%/usr/bin/grep%/bin/grep%g' \
 			-e 's%/usr/bin/sed%/bin/sed%g' \
 			-e 's%/usr/bin/dd%/bin/dd%g' \
 			-e 's%${CURDIR}%/build/libtool-2.4.6%g' \
-			$$f > debian/tmpff ; \
+			$$f > debian/tmpff && \
 		mv debian/tmpff $$f ; \
-		done
+		done)
 
 	dh_installdocs -plibtool-bin
 	dh_installdocs -plibltdl7
-- 
2.11.0

From c05824f6da28d61b70ce69b11ab56d5bf1b453e4 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Tue, 15 Jan 2019 05:17:03 +0100
Subject: [PATCH 6/7] Document robustness improvement.

---
 debian/changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/changelog b/debian/changelog
index b0570fc..c71377b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ libtool (2.4.6-8) UNRELEASED; urgency=medium
   * Fix sanitation of libtool vs. libtoolize; the former is shipped in
     libtool-bin (arch:any, so binary-arch target), the latter in libtool
     (arch:all, so binary-indep target).
+  * Make sure errors in sanitation loops are reported.
 
  -- Cyril Brulebois <kibi@debian.org>  Tue, 15 Jan 2019 03:41:15 +0000
 
-- 
2.11.0

From 7ab2a7287803e4818431ee69d07227da7bc5ff19 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Tue, 15 Jan 2019 05:18:20 +0100
Subject: [PATCH 7/7] Unhardcode upstream version from sanitation loops.

---
 debian/changelog | 1 +
 debian/rules     | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c71377b..e68c0c9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ libtool (2.4.6-8) UNRELEASED; urgency=medium
     libtool-bin (arch:any, so binary-arch target), the latter in libtool
     (arch:all, so binary-indep target).
   * Make sure errors in sanitation loops are reported.
+  * Unhardcode upstream version from sanitation loops.
 
  -- Cyril Brulebois <kibi@debian.org>  Tue, 15 Jan 2019 03:41:15 +0000
 
diff --git a/debian/rules b/debian/rules
index 675f856..2c08819 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,6 +6,7 @@
 #export DH_VERBOSE=1
 
 DEBIAN_REVISION=$(strip $(shell dpkg-parsechangelog | awk -F: '/^Version:/ {print $$NF}'))
+UPSTREAM_VERSION=$(strip $(shell dpkg-parsechangelog | awk -F: '/^Version:/ {print $$NF}' | sed 's/-.*//'))
 
 # libltdl needs to conform to policy
 export DEB_CFLAGS_MAINT_PREPEND = -Wall
@@ -165,7 +166,7 @@ binary-indep: build-indep install
 			-e 's%/usr/bin/grep%/bin/grep%g' \
 			-e 's%/usr/bin/sed%/bin/sed%g' \
 			-e 's%/usr/bin/dd%/bin/dd%g' \
-			-e 's%${CURDIR}%/build/libtool-2.4.6%g' \
+			-e 's%${CURDIR}%/build/libtool-$(UPSTREAM_VERSION)%g' \
 			$$f > debian/tmpff && \
 		mv debian/tmpff $$f ; \
 		done)
@@ -195,7 +196,7 @@ binary-arch: build-arch install
 			-e 's%/usr/bin/grep%/bin/grep%g' \
 			-e 's%/usr/bin/sed%/bin/sed%g' \
 			-e 's%/usr/bin/dd%/bin/dd%g' \
-			-e 's%${CURDIR}%/build/libtool-2.4.6%g' \
+			-e 's%${CURDIR}%/build/libtool-$(UPSTREAM_VERSION)%g' \
 			$$f > debian/tmpff && \
 		mv debian/tmpff $$f ; \
 		done)
-- 
2.11.0

diff -Nru libtool-2.4.6/debian/changelog libtool-2.4.6/debian/changelog
--- libtool-2.4.6/debian/changelog	2019-01-12 14:10:59.000000000 +0000
+++ libtool-2.4.6/debian/changelog	2019-01-15 03:41:15.000000000 +0000
@@ -1,3 +1,16 @@
+libtool (2.4.6-8) UNRELEASED; urgency=medium
+
+  * Fix Vcs-* URLs.
+  * Fix sed syntax errors leading to empty libtool executable and
+    manpage, with thanks to James McCoy for reporting. Closes: #919341
+  * Fix sanitation of libtool vs. libtoolize; the former is shipped in
+    libtool-bin (arch:any, so binary-arch target), the latter in libtool
+    (arch:all, so binary-indep target).
+  * Make sure errors in sanitation loops are reported.
+  * Unhardcode upstream version from sanitation loops.
+
+ -- Cyril Brulebois <kibi@debian.org>  Tue, 15 Jan 2019 03:41:15 +0000
+
 libtool (2.4.6-7) unstable; urgency=medium
 
   * Standards-Version: 4.3.0
diff -Nru libtool-2.4.6/debian/control libtool-2.4.6/debian/control
--- libtool-2.4.6/debian/control	2019-01-12 14:10:59.000000000 +0000
+++ libtool-2.4.6/debian/control	2019-01-15 03:41:12.000000000 +0000
@@ -17,8 +17,8 @@
 Standards-Version: 4.3.0
 Rules-Requires-Root: no
 Homepage: https://www.gnu.org/software/libtool/
-Vcs-Browser: https://salsa.debian.org:/mckinstry/libtool.git
-Vcs-Git: https://salsa.debian.org:/mckinstry/libtool.git
+Vcs-Browser: https://salsa.debian.org/mckinstry/libtool.git
+Vcs-Git: https://salsa.debian.org/mckinstry/libtool.git
 
 Package: libtool
 Architecture: all
diff -Nru libtool-2.4.6/debian/rules libtool-2.4.6/debian/rules
--- libtool-2.4.6/debian/rules	2019-01-12 14:10:59.000000000 +0000
+++ libtool-2.4.6/debian/rules	2019-01-15 03:41:15.000000000 +0000
@@ -6,6 +6,7 @@
 #export DH_VERBOSE=1
 
 DEBIAN_REVISION=$(strip $(shell dpkg-parsechangelog | awk -F: '/^Version:/ {print $$NF}'))
+UPSTREAM_VERSION=$(strip $(shell dpkg-parsechangelog | awk -F: '/^Version:/ {print $$NF}' | sed 's/-.*//'))
 
 # libltdl needs to conform to policy
 export DEB_CFLAGS_MAINT_PREPEND = -Wall
@@ -160,16 +161,15 @@
 	rm -f debian/libtool/usr/share/libtool/build-aux/config.sub
 	ln -s ../../misc/config.sub debian/libtool/usr/share/libtool/build-aux
 	# Sanitize /usr-merge path builds
-	for f in \
-		debian/libtool-bin/usr/share/man/man1/libtool.1 \
-		debian/libtool-bin/usr/bin/libtool ; do cat $$f | \
-			sed -e 's%/usr/bin/grep%/bin/grep%/g' | \
-			sed -e 's%/usr/bin/sed%/bin/sed%/g' | \
-			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
-			sed -e 's%${CURDIR}%/build/libtool-2.4.6%g' | \
-			> debian/tmpff ; \
+	(set -e; for f in \
+		debian/libtool/usr/bin/libtoolize ; do sed \
+			-e 's%/usr/bin/grep%/bin/grep%g' \
+			-e 's%/usr/bin/sed%/bin/sed%g' \
+			-e 's%/usr/bin/dd%/bin/dd%g' \
+			-e 's%${CURDIR}%/build/libtool-$(UPSTREAM_VERSION)%g' \
+			$$f > debian/tmpff && \
 		mv debian/tmpff $$f ; \
-		done
+		done)
 
 	dh_installdocs -i
 	dh_installinfo -plibtool-doc
@@ -190,16 +190,16 @@
 	dh_testroot -a
 
 	# Sanitize /usr-merge path builds
-	for f in \
-		debian/libtool/usr/bin/libtoolize ; do \
-		cat $$f | \
-			sed -e 's%/usr/bin/grep%/bin/grep%/g' | \
-			sed -e 's%/usr/bin/sed%/bin/sed%/g' | \
-			sed -e 's%/usr/bin/dd%/bin/dd%g' | \
-			sed -e 's%${CURDIR}%/build/libtool-2.4.6%g' | \
-			> debian/tmpff ; \
+	(set -e; for f in \
+		debian/libtool-bin/usr/share/man/man1/libtool.1 \
+		debian/libtool-bin/usr/bin/libtool ; do sed \
+			-e 's%/usr/bin/grep%/bin/grep%g' \
+			-e 's%/usr/bin/sed%/bin/sed%g' \
+			-e 's%/usr/bin/dd%/bin/dd%g' \
+			-e 's%${CURDIR}%/build/libtool-$(UPSTREAM_VERSION)%g' \
+			$$f > debian/tmpff && \
 		mv debian/tmpff $$f ; \
-		done
+		done)
 
 	dh_installdocs -plibtool-bin
 	dh_installdocs -plibltdl7

Attachment: signature.asc
Description: PGP signature


Reply to: