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

Bug#779212: blends-dev: prerm file causes lintian warning command-with-path-in-maintainer-script

Package: blends-dev
Severity: normal
Tags: patch


Lintian reports dozens of warnings for blends projects like


The warning is


Apparently the prepended path of blend-update-usermenus in the prerm
maintainer script is responsible for triggering this warning.

I have prepared a patch that replaces the check for
/usr/sbin/blend-update-usermenus in prerm with the recommended and
most portable check (pathfind) from the Debian Policy. This should
ensure that the functionality remains and the lintian warning goes



-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages blends-dev depends on:
ii  build-essential  11.7
ii  debconf          1.5.55
ii  debhelper        9.20150101
ii  make             4.0-8.1

blends-dev recommends no packages.

Versions of packages blends-dev suggests:
ii  blends-doc

-- no debconf information
>From 66d5603f1495e17e4682ef3620b215bbb339376b Mon Sep 17 00:00:00 2001
From: Markus Koschany <apo@gambaru.de>
Date: Wed, 25 Feb 2015 01:12:24 +0100
Subject: [PATCH] Fix command-with-path-in-maintainer-script

Programs called from maintainer scripts normally should not have a path
prepended. This commit uses the most portable function to test a program for
existence, in this case blend-update-usermenus, instead of using a hardcoded
 templates/prerm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/templates/prerm b/templates/prerm
index 5d245ee..4acf6a0 100755
--- a/templates/prerm
+++ b/templates/prerm
@@ -13,11 +13,29 @@ set -e
 # If the user menus are not needed/wished for a Blend (like for instance
 # Debian Edu there is no need to install blends-common package.  Thus we
 # have to make sure that postinst does not try to include the menu stuff
+# The most portable way to test a program for existence
+# This fixes https://lintian.debian.org/tags/command-with-path-in-maintainer-script.html
+pathfind() {
+    OLDIFS="$IFS"
+    IFS=:
+    for p in $PATH; do
+        if [ -x "$p/$*" ]; then
+            IFS="$OLDIFS"
+            return 0
+        fi
+    done
+    IFS="$OLDIFS"
+    return 1
 if [ -d /etc/blends -a -f /etc/blends/blends.conf ] ; then
     # Also verify that this Blend provides special configuration
     # If not there is no need to execute the user menu code
     if [ -d /etc/blends/#BLEND# -a -s /etc/blends/#BLEND#/#BLEND#.conf -a -s /etc/blends/blends.conf ] ; then
-	if [ -x /usr/sbin/blend-update-usermenus ] ; then
+	if pathfind blend-update-usermenus ; then
 	    . /etc/blends/blends.conf
 	    . /etc/blends/#BLEND#/#BLEND#.conf
 	    blend-update-menus --blend #BLEND# 

Reply to: