Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2012-08-27
18:18 • Closed ticket [1604355fff]: TclpOpenFileChannel : try to open file which don&#39... artifact: 777b2d9d43 user: dkf
2006-11-28
16:56 • Ticket [1604355fff]: 1 change artifact: ad05dfbb74 user: dkf
09:48 • New ticket [1604355fff]. artifact: 1aaabcf260 user: julien_dumont

TclpOpenFileChannel : try to open file which don't exist

Closed / Rejected1604355fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 14 years ago
Descriptionplain2006-11-28 09:48:48
TclpOpenFileChannel don't use stats for check if file exist before trying to open it.
This is very  usefull on nfs / autofs / network remote filesystem for avoid lags due to remote filesystem implementation.

Problem occurs on tcl 8.4.14

see patch (1604352)
dkf Ticket [1604355fff]: 1 change [History diff]2006-11-28 16:56:41
dkfplain2012-08-27 18:18:55
allow_comments - 1

I believe that the correct thing to do is to *not* stat() the file first, as that would introduce a race condition. Due to various bugs/"issues" in filesystem implementations on some OSes, it's also not at all certain that doing a stat() (or an access() for that matter) would give you useful information. (There have been AFS implementations which got access() wrong, and stat() ignores ACLs which may be set on many filesystems.)

Scripts can always use [file stat] or [file readable] themselves before the [open], but they should be aware that they run the risk of things changing or the information coming back being non-useful.

Sorry it causes excess logging outside Tcl, but we *must* prioritize getting Tcl's semantics correct.
Log in (anonymous is fine) to add a comment.