|
2006-03-23
| ||
| 18:36 | • Ticket [1084705fff] glob -nocomplain swallows all errors. status still Close... artifact: 8bb8eca32e user: jcw | |
| 17:20 | • Ticket [1084705fff]: 4 changes artifact: a70d89b6c4 user: dkf | |
| 16:56 | • Ticket [1084705fff]: 4 changes artifact: 39ea1b4400 user: vincentdarley | |
|
2006-03-22
| ||
| 21:11 | • Ticket [1084705fff]: 4 changes artifact: a4217bfcdb user: dgp | |
|
2006-03-20
| ||
| 06:07 | • Closed ticket [1084705fff]. artifact: 11a1de3f6d user: vincentdarley | |
| 02:16 | • Ticket [1084705fff]: 4 changes artifact: 123134ccb8 user: vincentdarley | |
| 02:16 | • Add attachment globnoc.diff to ticket [1084705fff] artifact: bbd65dbb5d user: vincentdarley | |
| 02:16 | • Ticket [1084705fff] glob -nocomplain swallows all errors. status still Open ... artifact: 224d2a3407 user: vincentdarley | |
|
2004-12-15
| ||
| 02:16 | • Ticket [1084705fff]: 5 changes artifact: 51e1473fd9 user: vincentdarley | |
|
2004-12-14
| ||
| 23:31 | • Ticket [1084705fff]: 4 changes artifact: d02ff124e0 user: jcw | |
| 23:21 | • Ticket [1084705fff]: 4 changes artifact: 4d64c481dc user: vincentdarley | |
| 23:06 | • Ticket [1084705fff]: 4 changes artifact: 16c9abbedb user: jcw | |
| 20:58 | • Ticket [1084705fff]: 4 changes artifact: 825674919b user: vincentdarley | |
|
2004-12-13
| ||
| 21:53 | • New ticket [1084705fff]. artifact: f918f82427 user: jcw | |
glob -nocomplain swallows all errors.
Closed / Fixed1084705fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 21 years ago
Descriptionplain2004-12-13 21:53:36
(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
vincentdarleyplain2004-12-14 20:58:52
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).
jcwplain2004-12-14 23:06:44
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.
vincentdarleyplain2004-12-14 23:21:08
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.
jcwplain2004-12-14 23:31:53
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
vincentdarleyplain2004-12-15 02:16:15
Logged In: YES user_id=32170 Updated summary line. You're probably right that this doesn't need a TIP -- I also think part of the historical motivation for it was that the code used to be structured so this was very difficult to achieve. That's no longer true, I think.
vincentdarleyplain2006-03-20 02:16:52
Logged In: YES user_id=32170 Attached is a patch to implement this - given the newer 'glob' code this is actually a decent simplification. We should clarify the documentation, of course.
vincentdarleyplain2006-03-20 02:16:53
File Added - 171484: globnoc.diff
vincentdarley Closed ticket [1084705fff].
[History diff]2006-03-20 06:07:51
dgpplain2006-03-22 21:11:13
Logged In: YES user_id=80530 any plan to backport the fix for 8.4.13 ?
vincentdarleyplain2006-03-23 16:56:56
Logged In: YES user_id=32170 The code cleanup that I think dkf applied to tclFileName.c a couple of years ago would need applying to 8.4 before these changes could be used in 8.4. So I don't have any current plans to do that.
dkfplain2006-03-23 17:20:18
Logged In: YES user_id=79902 IIRC, the code I cleaned out was something of a cesspit, in that it was complicated and very hard to analyse for correctness. Given that, backporting is a real chore (and I can't be bothered :-p ).
jcwplain2006-03-23 18:36:31
Logged In: YES user_id=1983 To what extent are 8.4 and 8.5 branches different w.r.t. VFS? And perhaps 2nd Q: why? I know there are init/encoding differences, but apart from that I've been able to keep 8.4/8.5 builds of Tclkit pretty much the same. And while we're at it: how about making the VFS subsystem more loosely coupled? If the native fs were optional, one could create a secure sandbox (by having only support for an end-of-exe VFS with runtime & starpack files). And more to the point: more code might be shareable between 8.4 and 8.5.
Log in (anonymous is fine) to add a comment.
Attachments:
- globnoc.diff [download] added by vincentdarley on 2006-03-20 02:16:52. [details]