Package: debianutils
Version: 2.17
Severity: normal
Tags: patch

Hello,

An element like ~/bin in the PATH variable is not searched by which
because the test is [ -f "$ELEMENT/$PROGRAM" ] and there is no tilde 
expansion within double quotes.

I propose the attached patch for replacing "~" by "$HOME" when an 
element begins with "~/".


-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (650, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages debianutils depends on:
ii  coreutils                   5.97-5.3     The GNU core utilities
ii  libc6                       2.3.6.ds1-11 GNU C Library: Shared libraries
ii  mktemp                      1.5-2        Makes unique filenames for tempora

debianutils recommends no packages.

-- no debconf information
--- /bin/which  2006-07-25 20:04:28.000000000 +0200
+++ ./which     2007-02-23 13:57:13.000000000 +0100
@@ -34,6 +34,9 @@
    ;;
   *)
    for ELEMENT in $PATH; do
+    case "$ELEMENT" in
+     "~"/*) ELEMENT="$HOME""${ELEMENT:1}" ;;
+    esac
     if [ -z "$ELEMENT" ]; then
      ELEMENT=.
     fi

Reply via email to