Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2014-02-25
15:51 • Closed ticket [8d5f5b8034]: string tolower does not invalidate list representati... artifact: 0a41539b22 user: dkf
15:49
[8d5f5b8034] Flush internal representations in [string tolower] of unshared obj check-in: 6504791ba5 user: dkf tags: trunk
15:19 • Ticket [8d5f5b8034] string tolower does not invalidate list representation s... artifact: 63cc39ebed user: dkf
15:12 • Ticket [8d5f5b8034]: 4 changes artifact: 55748532a6 user: jan.nijtmans
14:10 • New ticket [8d5f5b8034]. artifact: 68e01eef2f user: oehhar

string tolower does not invalidate list representation

Closed / Fixed8d5f5b80343e8e7d21d4dd96343a281895380ffdCreated 13 years agoUpdated 13 years ago
Descriptionwiki2014-02-25 14:10:04

Issue

string tolower does not remove a list representation in some circumstances

Environment

  • Fossil Trunk [29b5d483ec]
  • Compiled with MSVC6++, SDK2003SP1 and Makefile.vc
  • Windows Vista 32 bit GER

Demonstration

I stumbled over the fact, that the following test failed:
==== cmdAH-6.4 Tcl_FileObjCmd: volumes FAILED
==== Contents of test case:

    set volumeList [string tolower [file volumes]]
    set element [lsearch -exact $volumeList "c:/"]
    list [expr {$element>-1}] [glob -nocomplain [lindex $volumeList
$element]*]

---- Result was:
0 {aclocal.m4 buildall.vc.bat cat.c coffbase.txt configure configure.in
makefile.bc Makefile.in makefile.vc nmakehlp.c nmakehlp.exe nmakehlp.obj
README Release rules.vc tcl.dsp tcl.dsw tcl.hpj.in tcl.m4 tcl.rc
tclAppInit.c tclConfig.sh.in tclooConfig.sh tclsh.exe.manifest.in
tclsh.ico tclsh.rc tclWin32Dll.c tclWinChan.c tclWinConsole.c
tclWinDde.c tclWinError.c tclWinFCmd.c tclWinFile.c tclWinInit.c
tclWinInt.h tclWinLoad.c tclWinNotify.c tclWinPipe.c tclWinPort.h
tclWinReg.c tclWinSerial.c tclWinSock.c tclWinTest.c tclWinThrd.c
tclWinTime.c testlog_tcl-trunk_2014-02-24.txt versions.vc _junk.pch}
---- Result should have been (glob matching):
1 *
==== cmdAH-6.4 FAILED
Then, I started the freshly compiled tclsh86.exe and executed command by command:
% file volume
C:/ D:/ E:/ T:/ U:/ X:/ Y:/
% set volumeList [string tolower [file volumes]]
c:/ d:/ e:/ t:/ u:/ x:/ y:/
% set element [lsearch -exact $volumeList "c:/"]
-1
% lindex $volumeList 0
C:/
% set volumeList
c:/ d:/ e:/ t:/ u:/ x:/ y:/
IMHO, the list representation was not destroyed and the string is tolower but the list still uppercase.
Referenced by1
  • 6504791ba5[8d5f5b8034] Flush internal representations in [string tolower] of unshared obj check-in2014-02-25 15:49:52
jan.nijtmanswiki2014-02-25 15:12:40

Yes I can reproduce it. It works correct in tclsh85, but not in tclsh86.

>tclsh85
% set volumeList [string tolower [file volumes]]
c:/ d:/
% set element [lsearch -exact $volumeList "c:/"]
0
% lindex $volumeList 0
c:/
% set volumeList
c:/ d:/
% exit

>tclsh86 % set volumeList [string tolower [file volumes]] c:/ d:/ % set element [lsearch -exact $volumeList "c:/"] -1 % lindex $volumeList 0 C:/ % set volumeList c:/ d:/ %

dkfhtml2014-02-25 15:19:29

My bad. Forgot to purge internal representations in the bytecode implementation.

dkfhtml2014-02-25 15:51:24

All sorted. Note that this is a case when the fact that it involved filenames was not significant. That it was an unshared list that was modified was much more critical.

Log in (anonymous is fine) to add a comment.