Control: severity -1 important
Control: found -1 0.0.14
Control: retitle -1 sensible-utils: replace "which" by "command -v" in 
sensible-browser, sensible-editor and sensible-pager

On 2020-10-27 05:30:46 +0100, Harald Dunkel wrote:
> To avoid problems with user-supplied "which" or bad $PATH variables
> sensible-editor should use built-ins (e.g. "type") or absolute path names.

Now "which" is deprecated and a distracting warning is displayed.
This is even more annoying as one doesn't always know where it
comes from. For instance, I get

/usr/bin/which: this version of 'which' is deprecated and should not be used.
/usr/bin/which: this version of 'which' is deprecated and should not be used.

when installing Debian packages, and I had to use strace to find out
that these warnings came from sensible-pager (via apt-listchanges).

So, raising to important.

As /usr/share/doc/debianutils/NEWS.Debian.gz says:

  * The 'which' utility will be removed in the future.  Shell scripts
    often use it to check whether a command is available.  A more
    standard way to do this is with 'command -v'; for example:
      if command -v update-icon-caches >/dev/null; then
        update-icon-caches /usr/share/icons/...
      fi
    '2>/dev/null' is unnecessary when using 'command': POSIX says "no
    output shall be written" if the command isn't found.  It's also
    unnecessary for the debianutils version of 'which', and hides the
    deprecation warning.

So, this is easy to fix.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to