Tcl Source Code

View Ticket
Login
Ticket UUID: 3099612
Title: false, shortcut string /../ simplification everywhere, all f
Type: Bug Created on: 2010-10-31 06:15:59
Submitter: sto6 Assigned to: vincentdarley
Subsystem: 37. File System Severity:
Priority: 5 Medium Last modified: 2026-10-19 18:44:31
Status: Open Closed by:
Resolution: None Closed on:
Version: obsolete: 8.5.9
Description:
What someone called 'lexical treatment of /../' in paths,
was subject of bug 961646: [file normalize] changes file reference

Much worse, 8.4.x does false, shortcut string /../ simplification EVERYWHERE,
full-time for ALL access to files (i.e. not limited to file normalize).
8.4.x does not resolve symlinks ahead of the /../, before applying the '..'.

$ ls -ld /etc/httpd/run
lrwxrwxrwx 1 root root 13 Feb 24  2010 /etc/httpd/run -> ../../var/run

$ tclsh8.4
% file stat /etc/httpd/run/../tmp/. ary; puts $ary(ino)
could not read "/etc/httpd/run/../tmp/.": no such file or directory

(incorrectly stats /etc/httpd/tmp, ignoring that run is symlink, not a true dir)

$ tclsh8.5
% file stat /etc/httpd/run/../tmp/. ary; puts $ary(ino)
3746244

$ ls -id /etc/httpd/run/../tmp/.
3746244 /etc/httpd/run/../tmp/.

Some shells (e.g. bash) offer choice of logical versus physical symlink resolution
in the 'cd' command. Except for such specialized flexibility (a CHOICE to change dir
relative to a symlink-unresolved path) it is never correct to do this full-time
for all file access.

right: 8.3.3, Solaris8
right: 8.3.5, Linux RedHat EL3U6
WRONG: 8.4.2, Solaris8
WRONG: 8.4.13, Linux Centos5.2
WRONG: 8.4.19, Linux Centos5.2, ActiveTcl 8.4.19 32bit
right: 8.5.7, Mac-OS-X 10.6.4
right: 8.5.9, Linux Centos5.2, ActiveTcl 8.5.9 32bit

So no bug in 8.3.x, bug in 8.4.x, and no bug in 8.5.x.

How could this have plagued essentially all of 8.4.x?
Now fixed again, was it deliberately targeted (what bug#)?

Or is appearance, disappearance of this bug merely side-effect of
dozens of other bug fixes, at risk to return again in 8.5 or later
as the wind blows? ;)
User Comments:
dgp added on 2010-11-01 20:36:23:
Please find a test in the test suite
that tests this matter.  If one does not
exist, please provide one we can add.

serhiy.storchaka added on 2026-10-19 18:44:31:

This works correctly since 8.5 (the link is resolved before ".."), and [file normalize] is covered by filesystem-1.26 to 1.28. As asked, branch normalize-dotdot-after-link adds test filesystem-1.58 for [file stat] and [file exists] through a relative link and "..". The ticket can be closed when it is merged.