Tcl Source Code

Artifact [2637cd1988]
Login

Artifact 2637cd198882b5ca0acd8dd8506660218003cce8:

Attachment "normcache.patch" to ticket [953284ffff] added by dgp 2004-05-13 20:46:42.
? 623787.patch
? 729692.patch
? 811461.patch
? 856951.patch
? 859251.patch
? 860402.patch
? 875055.patch
? 918320.patch
? 940281.patch
? 941108.patch
? 943995.patch
? 945447.patch
? 946952.patch
? 947564.patch
? 948177.patch
? b2d.test.gz
? debug
? explore
? fsOpt.patch
? fsopt.patch
? fsopt2.patch
? fsopt2.patch.dos
? fsopt3.patch
? fsopt5.patch
? headers.patch
? normcache.patch
? ppp
? return.patch
? robust.patch
? solaris
? solcc
? solthread
? tclPort.diff
? tclPort.diff-old
? thread
? undo.patch
? generic/evex
? generic/notes
? generic/pds
? generic/tclCmdAH.c.ip
? generic/tclFileName.c-mystery
? generic/temp
? generic/tmp
? library/latest.diff
? library/tcltest/constraints.tcl
? library/tcltest/files.tcl
? library/tcltest/testresults.tcl
? unix/.nfs000000000002ce440000000a
? unix/autom4te.cache
? unix/blame
? unix/dltest.marker
? unix/httpd_28037
? unix/ne.tcl
? unix/stGHhF8h
? unix/stJW2eiX
? unix/tclUnixFCmd.c-mine
? win/autom4te.cache
Index: tests/fileSystem.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/fileSystem.test,v
retrieving revision 1.41
diff -u -r1.41 fileSystem.test
--- tests/fileSystem.test	7 May 2004 07:44:38 -0000	1.41
+++ tests/fileSystem.test	13 May 2004 13:44:36 -0000
@@ -422,6 +422,47 @@
     }
 } {ok}
 
+test filesystem-1.42 {file normalisation: outdated cache} -setup {
+    set w [makeDirectory wrong]
+    makeFile wrong file $w
+    set r [makeDirectory right]
+    makeFile right file $r
+    set link [file join [file dirname $w] link]
+    file link $link wrong
+} -body {
+    set p1 [file join $link file]	;# $p1 and $p2 have same (string)
+    set p2 [file join $link file]	;# value
+    file normalize $p1		;# cache the "wrong" normalized path
+
+    file delete $link
+    file link $link right	;# change link reference
+
+    # Because string values are the same, according to Tcl value
+    # rules, these operations should produce consistent results.
+    # They do not, because $p1 holds an outdated cached normalized
+    # path, breaking "everything is a string".
+    set result {}	
+    lappend result $p1
+    set f [open $p1]
+    lappend result [read -nonewline $f]
+    close $f
+    lappend result [file normalize $p1]
+
+    lappend result $p2
+    set f [open $p2]
+    lappend result [read -nonewline $f]
+    close $f
+    lappend result [file normalize $p2]
+
+} -cleanup {
+    file delete $link
+    removeFile file $r
+    removeDirectory right
+    removeFile file $w
+    removeDirectory wrong
+} -match glob -result\
+{*/link/file right */right/file */link/file right */right/file}
+
 test filesystem-2.0 {new native path} {unixOnly} {
    foreach f [lsort [glob -nocomplain /usr/bin/c*]] {
        catch {file readlink $f}