Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-04-26
22:52 • Closed ticket [941108ffff]: TclpObjNormalizePath(unix) breaks VFS spec plus ... artifact: 90ea4834f2 user: dgp
22:40 • Ticket [941108ffff]: 4 changes artifact: a1779bfcdd user: vincentdarley
22:32 • Ticket [941108ffff]: 4 changes artifact: 057d83e70f user: dgp
22:15 • Ticket [941108ffff]: 5 changes artifact: 712528d430 user: vincentdarley
2004-04-24
10:00 • Ticket [941108ffff]: 4 changes artifact: c0bea30447 user: dgp
10:00 • Add attachment 941108.patch to ticket [941108ffff] artifact: 4edbebfab9 user: dgp
02:10 • New ticket [941108ffff] TclpObjNormalizePath(unix) breaks VFS spec. artifact: 48d1e88492 user: dgp

TclpObjNormalizePath(unix) breaks VFS spec

Closed / Fixed941108ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2004-04-24 02:10:40
The Tcl_FSNormalizePathProc of a 
Tcl_Filesystem gets three arguments,

  (TclInterp *interp,
   Tcl_Obj *pathPtr,
   int nextCheckPoint)

and an int return value.

It's spelled out in in the Tcl_Filesystem
docs that both nextCheckPoint and
the returned value should be indices
into the pathPtr->bytes array and the
value should point to either the start
(0) the end (bytes[cp] == '\0') or
to a separator character, usually '/'.

The unix TclpObjNormalizePath()
routine does not follow these rules;
it returns a value that points "one past"
the separator, not to it.

The correction is simple, just remove
lines 1805-1807 from unix/tclUnixFCmd.c
Those lines incorrectly advance the
checkpoint value one past where it
ought to be.

Removing those lines leads to no
new failures in the test suite on three
different unix systems I tried.
dgpplain2004-04-24 10:00:23
File Added - 84878: 941108.patch

Logged In: YES 
user_id=80530


Even better, in addition to removing
those lines, it appears that 
TclpObjNormalizePath can claim
to have normalized the whole thing
rather than just all but the final
component via this patch.
vincentdarleyplain2004-04-26 22:15:23
Logged In: YES 
user_id=32170

Please do commit the fix.
dgpplain2004-04-26 22:32:18
Logged In: YES 
user_id=80530

which one?

The additional access() call
is helpful when there are
other FS's registered, as it
will let the native FS claim
the entire path when it can.

However, when there's only
a native FS around, the
additional access() call
adds to the overhead of path
normaliztaion.

Intermingled with this is
Bug 931847.  The plans
for revising Tcl_FSNTUP
might influence the choice.
vincentdarleyplain2004-04-26 22:40:34
Logged In: YES 
user_id=32170

Oh yes, I would commit the simpler one now (no 'access'
check), but consider adding the other check in place if/when
the needs of the other discussions/fixes require it.
dgp Closed ticket [941108ffff]. [History diff]2004-04-26 22:52:03
Log in (anonymous is fine) to add a comment.

Attachments: