Ticket UUID: | 3141568 | |||
Title: | find errors out on broken directory soft links | |||
Type: | Bug | Version: | None | |
Submitter: | guardus | Created on: | 2010-12-22 08:09:59 | |
Subsystem: | fileutil | Assigned To: | andreas_kupries | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2013-01-09 07:18:40 | |
Resolution: | Fixed | Closed By: | andreas_kupries | |
Closed on: | 2013-01-09 00:18:40 | |||
Description: |
fileutil::find errors out on broken directory soft links. I am running ActiveTcl 8.5.9.1 on Windows XP and fileutil 1.14.4 from the Activestate Teapot. See attached error.tcl script. Basically, the link1_test link points to a non-existent directory, and then "glob -nocomplain -directory link1_test -- *" errors out. (One could argue that this should not error out because "glob -nocomplain -directory non_existent_dir -- *" does not error out, but that's not a tcllib issue.) [510] ./error.tcl first find results: ./.error.tcl.un~ ./error.tcl ./error.tcl+ ./.error.tcl.swp ./dir1_test ./link1_test couldn't read directory "C:/temp/tmp/link1_test/*": no such file or directory while executing "glob -nocomplain -directory $current -types f -- *" (procedure "GLOBF" line 2) invoked from within "GLOBF $current" (procedure "find" line 48) invoked from within "find . {string match *}" invoked from within "set findResults2 [find . {string match *}]" (file "./error.tcl" line 19) I worked around this by adding a test at the beginning of GLOBF and GLOBD. proc ::fileutil::GLOBF {current} { if {([file type $current] eq {link}) && ![file exists [file readlink $current]]} { return {} } ... | |||
User Comments: |
andreas_kupries added on 2013-01-09 07:18:40:
allow_comments - 1 Committed revision [91efe94a91] . Bumped to version 1.14.5. guardus added on 2011-01-19 18:19:14: Better workaround: proc ::fileutil::GLOBF {current} { global tcl_platform if {[file type $current] eq {link}} { set tgt [fullnormalize $current] if {![file readable $tgt]} { return {} } # At least in Windows XP, a junction can point to same name as a file. # This will create a glob error below. if {$tcl_platform(platform) eq {windows}} { if {[file isdirectory $current] != [file isdirectory $tgt]} { return {} } } } ... guardus added on 2010-12-22 15:09:59: File Added - 396691: error.tcl |
Attachments:
- error.tcl [download] added by guardus on 2010-12-22 15:09:59. [details]