Tcl Source Code

View Ticket
Login
Ticket UUID: 1969717
Title: package require fails due to [file readable] problem
Type: Patch Version: None
Submitter: decosterjos Created on: 2008-05-22 16:09:56
Subsystem: 39. Package Manager Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2008-07-04 00:27:41
Resolution: Accepted Closed By: dgp
    Closed on: 2008-07-03 17:27:41
Description:
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.
User Comments: dgp added on 2008-07-04 00:27:41:
Logged In: YES 
user_id=80530
Originator: NO


committed to all branches

andreas_kupries added on 2008-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.

decosterjos added on 2008-06-30 13:30:54:
Logged In: YES 
user_id=370749
Originator: YES

Alternative patch works fine for me.

Thanks & regards,

Jos.

dgp added on 2008-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 added on 2008-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.

dgp added on 2008-06-27 23:41:44:

File Added - 282946: 1969717.patch

Logged In: YES 
user_id=80530
Originator: NO

File Added: 1969717.patch

decosterjos added on 2008-05-22 23:09:57:

File Added - 278689: catch_open.patch

Attachments: