Tcl Source Code

View Ticket
Login
Ticket UUID: 2385549
Title: [file normalize] can't handle all "path" intreps
Type: Bug Created on: 2008-12-04 00:29:04
Submitter: dgp Assigned to: dgp
Subsystem: 37. File System Severity:
Priority: 9 Immediate Last modified: 2008-12-05 00:47:09
Status: Closed Closed by: dgp
Resolution: Fixed Closed on: 2008-12-04 17:47:09
Version: obsolete: 8.6a4
Description:
% file normalize dltest/..
/home/dgp/cvs/tcl/unix

% lindex [glob -types hidden dltest/..] 0
dltest/..
% file normalize [lindex [glob -types hidden dltest/..] 0]
/home/dgp/cvs/tcl/unix/dltest/..

The same string value gets treated
differently due to different intrep
history.

Fundamentally this is a flaw in
Tcl_FSGetNormalizedPath(), and is
the underlying cause of Bug 2378350
in the tclvfs project.
User Comments:
dgp added on 2008-12-04 07:30:27:
This same bug is present in all
active branches, 8.4, 8.5, 8.6,
but is more serious in 8.5+
because the troublesome intrep
is more widely used.

dgp added on 2008-12-04 07:46:51:
Here's the corrected demo to show the
flaw on 8.4.19+ as well:

% file normalize dltest/..
/home/dgp/cvs/tcl8.4/unix
% lindex [glob -type hidden dltest/*] 1
dltest/..
% file normalize [lindex [glob -type hidden dltest/*] 1]
/home/dgp/cvs/tcl8.4/unix/dltest/..
% info patch
8.4.19

dgp added on 2008-12-04 08:02:17:
Patch 682500 introduced this bug
when it was committed for Tcl 8.4.2
on 2003-02-10.

dgp added on 2008-12-04 08:04:55:
With the archeology aside, the fact
of intrep-dependent behavior is
unquestionably a bug, but doesn't
answer which is correct.

I'll proceed on the assumption that
supressing the /../ is the aim, but
that may well run against the expectations
of yet something else.  This whole
section of code is an inconsistent mess.

dgp added on 2008-12-05 00:47:08:
Fixes committed for 8.4.20, 8.5.6, and 8.6b1