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

Bug#747320: Mandate "type" in /bin/sh



Package: debian-policy
Version: 3.9.5.0

I came across this in /etc/init.d/exim4:

  OLDIFS="$IFS"
  IFS=:
  for p in $PATH; do
    if [ -x "$p/$UPEX4CONF" ]; then
      IFS="$OLDIFS"
      $p/$UPEX4CONF $UPEX4OPTS
      return 0
    fi
  done
  IFS="$OLDIFS"

I imagine that this kind of thing is found in many other places.

It seems to me that given that dash and bash both provide `type', and
the underlying functionality necessarily exists in the shell, it would
be better to mandate that the shell expose it.

I therefore propose that the following should be added to the list of
additional features listed in policy 10.4:

  * The XSI extension `type' must be supported .  It must exit
    zero iff the command is found.  The output format is not
    specified and scripts must not rely on it; scripts should
    rely only on the exit code using a construct such as
       if type foo >/dev/null 2>&1; then ...

Thanks,
Ian.


Reply to: