Re: is this a bashism?
Joey Hess wrote:
> Adam Di Carlo wrote:
> > This is irrelevant to you original question, but I really prefer to
> > use the POSIX 'command' command in order to determine whether an
> > executable exists on the path. I feel it is problematic to hard-code
> > paths into scripts, and any way to avoid that is a good thing.
Some think of it as a security feature.
> > [...]
> > if [ -x /usr/bin/update-menus ] ; then update-menus ; fi
> In fact, I just ran into the 'command' idiom when I was adding doc-base
> support to debhelper today. Debhelper now uses it for update-menus as well.
Absolute paths protect from bogus executables on path.
Of course, package installation is done by root, and
nothing protects against root. Besides, root WILL KNOW
not to have anything in path that resembles any command
that is used in any of scripts of Debian packages.
If root does not yet know it then root WIll KNOW.
Paths, even absolute, are only evil if it is more
important to accommodate change than not to.
Of course, even older debhelper does not use Debian
implementation, it only checks that one exists.
the nit picking one