Skip to content
Tcl Source Code View Ticket
Login

View Ticket

package require fails due to [file readable] problem

Closed / Accepted1969717fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 18 years ago
Descriptionplain2008-05-22 16:09:56
Platform: Windows

Version: head

Observation: [package require] fails for a package located on a drive mounted via samba

This problem is caused by [file readable] failing to get the correct access rights for the pkgIndex.tcl files on this samba drive. I look into the 'NativeAccess' code in tclWinFile.c and could not find what is wrong. Pat Thoyts also looked at the code and couldn't see what's caused [file readable] to fail. 

I suggest a work around for [package require] by replacing the [file readable $file] by a [catch {open $file r}]. This solves the [package require] problem. [file readable] still remains 'fragile' but the user can work around that problem in his own code when needed.

It's not clear where the problem originates. Could be a samba problem, could be a problem with the code in tclWinFile.c.

I attached a patch for package.tcl (head).

Regards,

Jos.
decosterjosplain2008-05-22 23:09:57
File Added - 278689: catch_open.patch
dgp Ticket [1969717fff]: 1 change [History diff]2008-06-03 21:18:10
dgpplain2008-06-27 23:41:44
File Added - 282946: 1969717.patch

Logged In: YES 
user_id=80530
Originator: NO

File Added: 1969717.patch
dgpplain2008-06-27 23:44:13
Logged In: YES 
user_id=80530
Originator: NO


Please review and test the alternative patch.

Advantage over the first is that it gets by
with opening each file once instead of twice.

Disadvantage is that in the rare case that
a pkgIndex.tcl script contains an error trying
to read a non-readable file, the usual logging
of that error would get suppressed.  I can't
really imagine why a sensible index script
would attempt such an operation, so I think
the alternative patch is better.
dgpplain2008-06-28 00:37:16
File Added - 282953: 1969717-85.patch

Logged In: YES 
user_id=80530
Originator: NO


corresponding patch for 8.5 and HEAD
File Added: 1969717-85.patch
dgp Ticket [1969717fff]: 1 change [History diff]2008-06-30 02:57:38
decosterjosplain2008-06-30 13:30:54
Logged In: YES 
user_id=370749
Originator: YES

Alternative patch works fine for me.

Thanks & regards,

Jos.
andreas_kupriesplain2008-07-01 04:41:49
Logged In: YES 
user_id=75003
Originator: NO

Go ahead. Looked over the patch and the basic principle (try to source, and check exact of a failure cause after the fact) seems good to me. I don't see any syntax errors either.
dgpplain2008-07-04 00:27:41
Logged In: YES 
user_id=80530
Originator: NO


committed to all branches
Log in (anonymous is fine) to add a comment.

Attachments: