FWD: Bug#75587: debhelper uses bashisms in /bin/sh scripts
I could use "test -x" rather than command, but this breaks as soon as
any of the programs move to a new location (this has happened in the
past). Ash supports command -v, as does bash. AFAIK, command is in
posix, but the -v switch may not be.
Any advice?
----- Forwarded message from Sam Hartman <hartmans@mit.edu> -----
From: Sam Hartman <hartmans@mit.edu>
Date: Wed, 25 Oct 2000 20:38:52 -0400 (EDT)
To: submit@bugs.debian.org
Subject: Bug#75587: debhelper uses bashisms in /bin/sh scripts
Reply-To: Sam Hartman <hartmans@mit.edu>, 75587@bugs.debian.org
Package: debhelper
Version: 2.0.86
I have a setuid binary in a package I'm building called krb5-user. I
don't need any postinst commands besides those added by debhelper, so
I don't have a krb5-user.postinst.
So, the postinst script produced in the package looks like:
#!/bin/sh -e
# Automatically added by dh_installdocs
if [ "$1" = "configure" ]; then
if [ -d /usr/doc -a ! -e /usr/doc/krb5-user -a -d /usr/share/doc/krb5-user ]; then
ln -sf ../share/doc/krb5-user /usr/doc/krb5-user
fi
fi
# End automatically added section
# Automatically added by dh_suidregister
if command -v suidregister >/dev/null 2>&1 && [ -e /etc/suid.conf ]; then
suidregister -s krb5-user /usr/bin/ksu root root 04755
elif [ -e /usr/bin/ksu ]; then
chown root.root /usr/bin/ksu
chmod 04755 /usr/bin/ksu
fi
# End automatically added section
So, I see two problems with this script.
First, according to policy section 4.4, scripts that use /bin/sh as
their shell MUST only use Posix features. As far as I can tell,
command is a Bash builtin and is not mandated in a Posix shell. Thus,
if the postinst in going to use command, it MUST use /bin/bash not /bin/sh.
According to the same section of policy, the script should restrict
its features to Posix shell when possible. I believe that removing
command and calling suidregister directly would work fine so I
recommend that the word command be removed so that postinst scripts
produced by Debhelper can use /bin/sh.
--Sam
--
To UNSUBSCRIBE, email to debian-bugs-dist-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
----- End forwarded message -----
--
see shy jo
Reply to: