From: SourceForge.net <no...@so...> - 2004-12-14 16:31:54
|
Bugs item #1084705, was opened at 2004-12-13 22:53 Message generated for change (Comment added) made by jcw You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1084705&group_id=10894 Category: 36. File System Group: current: 8.4.9 Status: Open Resolution: None Priority: 5 Submitted By: Jean-Claude Wippler (jcw) Assigned to: Vince Darley (vincentdarley) Summary: cannot make VFS driver throw error in glob Initial Comment: (This may be a TclVFS issue, but I'm not sure) Am writing a VFS driver in Tcl, which needs to throw errors (EACCESS) for certain calls to "glob" from Tcl. The "matchindirectory" handles glob, but I cannot make it generate errors which get thrown back to the caller of glob. A TclVFS driver with the following definition in it returns an empty list for glob, instead of throwing an error: proc matchindirectory {conn path actualpath pattern type} { error bah! } A related detail perhaps is mentioned on the wiki at the end of page http://mini.net/tcl/12328 - it does not apply to matchindirectory, which according to the docs does not use posixerror, but I'll include it for completeness: % vfs::filesystem posixerror 13 command returned bad code: -1 % My test environment was a couple of different 8.4.9 and 8.5a2 builds on Mac OS X (tclsh's, wish's, and tclkit's). None return an error from glob. -jcw ---------------------------------------------------------------------- >Comment By: Jean-Claude Wippler (jcw) Date: 2004-12-14 17:31 Message: Logged In: YES user_id=1983 It would have, indeed. I apologize for not detecting the difference (I always use -nocomplain). Do we really need a TIP? The docs do not mention eating errors in glob: http://www.tcl.tk/man/tcl8.4/TclCmd/glob.htm#M7 I can of course set a global flag in the driver, and check it at the call site, but the current behavior sure took me by surprise. -jcw ---------------------------------------------------------------------- Comment By: Vince Darley (vincentdarley) Date: 2004-12-14 17:21 Message: Logged In: YES user_id=32170 It would've been helpful if you had mentioned that -nocomplain was used in the original report! Tcl's glob has always discarded all errors when using '-nocomplain'. Hence you are asking for a changed behaviour in Tcl. I think the reason for this behaviour is probably that glob takes multiple pattern arguments: glob -nocomplain a* b* ~asdasd is supposed to concatenate the lists for each pattern in turn. Hence -nocomplain's behaviour of ignoring all errors (else an error in one pattern would mess up a different one). I don't necessarily agree that this is good, but Tcl has always done this. In fact I'd be keen to change this behaviour, but am not sure it is possible without a TIP. Vince. ---------------------------------------------------------------------- Comment By: Jean-Claude Wippler (jcw) Date: 2004-12-14 17:06 Message: Logged In: YES user_id=1983 Attached a test file errvfs.tcl, which is testvfs.tcl but edited to always throw an error in matchindirectory. Here's the output from this script: OK: { glob D* } result {Desktop Documents} OK: { glob -nocomplain D* } result {Desktop Documents} ERROR: { glob blah* } -> code 1 msg {no files matched glob pattern "blah*"} OK: { glob -nocomplain blah* } result {} ERROR: { glob root/blah* } -> code 1 msg BOOM! OK: { glob -nocomplain root/blah* } result {} The last case explains the problem I ran into: -nocomplain loses all errors, not just from returning no match. ---------------------------------------------------------------------- Comment By: Vince Darley (vincentdarley) Date: 2004-12-14 14:58 Message: Logged In: YES user_id=32170 Can you please attach the vfs driver and instructions for reproducing the bug (i.e. a test case of some kind). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1084705&group_id=10894 |