Tcl Source Code

View Ticket
Login
Ticket UUID: 8d5f5b80343e8e7d21d4dd96343a281895380ffd
Title: string tolower does not invalidate list representation
Type: Bug Version: [29b5d483ec]
Submitter: oehhar Created on: 2014-02-25 14:10:04
Subsystem: 18. Commands M-Z Assigned To: dkf
Priority: 9 Immediate Severity: Critical
Status: Closed Last Modified: 2014-02-25 15:51:24
Resolution: Fixed Closed By: dkf
    Closed on: 2014-02-25 15:51:24
Description:

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.

User Comments: dkf added on 2014-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.


dkf added on 2014-02-25 15:19:29:

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


jan.nijtmans added on 2014-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:/ %