Browse Source

* 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).
dejagnu-1.6
Ben Elliston 11 years ago
parent
commit
329a811efc
  1. 6
      ChangeLog
  2. 15
      lib/utils.exp

6
ChangeLog

@ -1,3 +1,9 @@
2016-03-28 Ben Elliston <bje@gnu.org>
* 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).
2016-03-28 Ben Elliston <bje@gnu.org>
* baseboards/multi-sim.exp: Indent properly.

15
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"
}
}
}

Loading…
Cancel
Save