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

Bug#563121: dh_installdefoma leads to buggy maintainer scripts



On Thu, 31 Dec 2009 01:06:48 +0100, Cyril Brulebois <kibi@debian.org> wrote:
> Package: defoma
> Version: 0.11.10-3
> Severity: grave
> Justification: Fucks up fontconfig (at least), then buildds.
> 
> Hi,
> 
> dh_installdefoma leads to this kind of code in maintainer scripts:
>   test -x `which foo` && foo bar baz
> 
> The trick being that if foo isn't found by which, “foo bar baz” gets
> executed, leading to broken packages (see fontconfig's #559136 and
> #560252 for examples).
> 
> A pair of quotes would fix this:
> | kibi@finzi:~$ test -x `which foo` && foo bar baz
> | -bash: foo: command not found
> | kibi@finzi:~$ test -x "`which foo`" && foo bar baz
> | kibi@finzi:~$ 
> 
> I'm about to QA-upload defoma with this change in the various
> debhelper-files/* files, but I wanted to open this bugreport for
> reference.
> 
> Cc'ing defoma folks and buildd folks, since they might be interested in
> knowing about this.
> 
> Mraw,
> KiBi.

Here's a patch which I've used to build new fontconfig packages which
should survive the absence of defoma.

From be25cdff52258c76ab0cf5d5fac4c21980c5dc01 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Wed, 30 Dec 2009 17:31:47 -0800
Subject: [PATCH] Fix debhelper files to work when defoma is not installed

test -x `which defoma-app` returns 0 when defoma is not installed,
which breaks several of the debhelper scripts.
---
 debhelper-files/postinst-defoma       |    2 +-
 debhelper-files/postinst-defoma-hints |    2 +-
 debhelper-files/prerm-defoma          |    4 ++--
 debhelper-files/prerm-defoma-hints    |    2 +-
 debhelper-files/prerm-defoma2         |    2 +-
 debian/changelog                      |    7 +++++++
 6 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/debhelper-files/postinst-defoma b/debhelper-files/postinst-defoma
index 8819ce4..513f203 100644
--- a/debhelper-files/postinst-defoma
+++ b/debhelper-files/postinst-defoma
@@ -1,5 +1,5 @@
 if [ "$1" = "configure" ]; then
 
-  test -x `which defoma-app` && defoma-app update #PACKAGE#
+  which defoma-app >/dev/null && defoma-app update #PACKAGE#
 
 fi
diff --git a/debhelper-files/postinst-defoma-hints b/debhelper-files/postinst-defoma-hints
index 83e1e8b..7c47ed8 100644
--- a/debhelper-files/postinst-defoma-hints
+++ b/debhelper-files/postinst-defoma-hints
@@ -1,4 +1,4 @@
 FILE='/etc/defoma/hints/#PACKAGE#.hints'
 if [ "$1" = configure ]; then
-	test -x `which defoma-font` && defoma-font reregister-all $FILE
+	which defoma-font >/dev/null && defoma-font reregister-all $FILE
 fi
diff --git a/debhelper-files/prerm-defoma b/debhelper-files/prerm-defoma
index fc05dcc..109db01 100644
--- a/debhelper-files/prerm-defoma
+++ b/debhelper-files/prerm-defoma
@@ -1,10 +1,10 @@
 case "$1" in
 	upgrade)
-		test -x `which defoma-app` && \
+		which defoma-app >/dev/null && \
 			defoma-app clean #PACKAGE#
 		;;
 	remove)
-		test -x `which defoma-app` && \
+		which defoma-app >/dev/null && \
 			defoma-app purge #PACKAGE#
 		;;
 esac
diff --git a/debhelper-files/prerm-defoma-hints b/debhelper-files/prerm-defoma-hints
index 1fdef0f..f9e75e8 100644
--- a/debhelper-files/prerm-defoma-hints
+++ b/debhelper-files/prerm-defoma-hints
@@ -1,4 +1,4 @@
 FILE='/etc/defoma/hints/#PACKAGE#.hints'
 if [ "$1" = remove ]; then
-	test -x `which defoma-font` && defoma-font purge-all $FILE
+	which defoma-font >/dev/null && defoma-font purge-all $FILE
 fi
diff --git a/debhelper-files/prerm-defoma2 b/debhelper-files/prerm-defoma2
index 6d75ee9..90c5fdb 100644
--- a/debhelper-files/prerm-defoma2
+++ b/debhelper-files/prerm-defoma2
@@ -1,6 +1,6 @@
 case "$1" in
 	remove)
-		test -x `which defoma-app` && \
+		which defoma-app >/dev/null && \
 			defoma-app purge #PACKAGE#
 		;;
 esac
diff --git a/debian/changelog b/debian/changelog
index 1758b4b..5be56df 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+defoma (0.11.10-3.1) unstable; urgency=high
+
+  * Fix debhelper scripts to work when defoma is not installed.
+    (Closes: #563121)
+
+ -- Keith Packard <keithp@debian.org>  Wed, 30 Dec 2009 17:34:01 -0800
+
 defoma (0.11.10-3) unstable; urgency=low
 
   * QA upload to fix errors in previous QA upload
-- 
1.6.5.7

-- 
keith.packard@intel.com

Attachment: pgpkUHEhH2nEL.pgp
Description: PGP signature


Reply to: