aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Elliston <bje@gnu.org>2016-03-28 13:37:59 +1100
committerBen Elliston <bje@gnu.org>2016-03-28 13:38:38 +1100
commit329a811efc1f5a4896e4248f3d031690a15a0aa9 (patch)
tree1957e5e160e5569ef50e5574d7357d1d830dfd51 /lib
parent94b3b8a0155f6faec8b52e2d220ee7a970cad785 (diff)
* lib/utils.exp (which): Don't exclude symbolic links--Debian's
/bin/which doesn't. Modern systems rely too heavily on symbolic links (eg. alternatives).
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.exp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/utils.exp b/lib/utils.exp
index e6850b1..8a9479c 100644
--- a/lib/utils.exp
+++ b/lib/utils.exp
@@ -133,9 +133,8 @@ proc which { file } {
# if the filename has a path component, then the file must exist
if {[llength [file split $file]] > 1} {
verbose "Checking $file" 2
- if {[file exists $file] && \
- [file executable $file] && [file type $file] == "file"} {
- verbose "file $file is executable and not a link" 2
+ if {[file exists $file] && [file executable $file]} {
+ verbose "file $file is executable" 2
return [file normalize $file]
} else {
return 0
@@ -151,13 +150,13 @@ proc which { file } {
foreach dir $path {
verbose "Checking $dir for $file" 3
- set filename [file join $dir $file]
+ set filename [file normalize [file join $dir $file]]
if {[file exists $filename]} {
- if {[file executable $filename] && [file type $filename] == "file"} {
- verbose "file $filename is executable and not a link" 2
- return $filename
+ if {[file executable $filename]} {
+ verbose "Choosing $filename" 2
+ return [file normalize $filename]
} else {
- warning "file $filename exists but is not executable or is a link"
+ warning "file $filename exists but is not executable"
}
}
}