diff -r 20dd8cef1c8a -r 57cda75fd174 scripts/functions --- a/scripts/functions Thu Jul 29 19:30:37 2010 +0200 +++ b/scripts/functions Fri Jul 30 17:50:34 2010 +0200 @@ -137,18 +137,16 @@ CT_DoLog ${level:-INFO} "(elapsed: ${elapsed_min}:${elapsed_sec}.${elapsed_csec})" } -# Remove entries referring to ., /tmp and non-existing directories from $PATH +# Remove entries referring to . and other relative paths # Usage: CT_SanitizePath CT_SanitizePath() { local new - local tmp + local p local IFS=: for p in $PATH; do - # Replace any occurence of . with $(pwd -P) - # Use /tmp as a default if the directory is non-existent - # Do not add /tmp in the PATH - tmp="$( cd /tmp; cd "${p}" 2>/dev/null || true; pwd -P )" - if [ "${tmp}" != "/tmp" ]; then + # Only accept absolute paths; + # Note: as a special case the empty string in PATH is equivalent to . + if [ -n "${p}" -a -z "${p%%/*}" ]; then new="${new}${new:+:}${p}" fi done