Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-06-02
22:59 • Closed ticket [747575ffff]: WinNT - file rename incorrect error message pl... artifact: 3005c7db98 user: vincentdarley
22:09 • Ticket [747575ffff]: 1 change artifact: ad88b25ce4 user: dkf
22:08 • Ticket [747575ffff]: 2 changes artifact: 738c3db2ff user: dkf
15:01 • New ticket [747575ffff]. artifact: 49371573a6 user: jgodfrey

WinNT - [file rename] incorrect error message

Closed / Fixed747575ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-06-02 15:01:30
System: ActiveTcl 8.4.2 / WinNT

- In a Windows command window, create a 
directory.  Say.... "temp"
- Now, cd into the new temp directory (to tie it up)
- Now, in a tclsh (actually, wish console window in 
my case), try to
rename the temp directory to "temp1"

(jgodfrey) 8 % file rename -force -- temp temp1
error renaming "temp" to "temp1": trying to rename 
a volume or move a
directory into itself
(jgodfrey) 9 %

"trying to move a directory into itself"?  Huh?  That 
can't be
right...

- Now, try to rename temp to a name that doesn't 
itself begin with
"temp"...

(jgodfrey) 9 % file rename -force -- temp newdir
error renaming "temp" to "newdir": permission 
denied
(jgodfrey) 10 % 

Ahhh, a more sensible message...

The problem seems to be in "tclWinFCmd.c" in the 
following code:

    src = Tcl_WinTCharToUtf((TCHAR *) 
nativeSrcPath, -1, &srcString);
    dst = Tcl_WinTCharToUtf((TCHAR *) 
nativeDstPath, -1, &dstString);
    if (strncmp(src, dst, (size_t) 
Tcl_DStringLength(&srcString)) == 0) {
/*
 * Trying to move a directory 
into itself.
 */

The source and destination are compared, but only 
out to the length of the source string.  There seems 
to be more needed in this check, although I'm not 
sure what the "safest" fix is...
dkf Ticket [747575ffff]: 2 changes [History diff]2003-06-02 22:08:25
dkf Ticket [747575ffff]: 1 change [History diff]2003-06-02 22:09:00
vincentdarleyplain2003-06-02 22:59:32
Logged In: YES 
user_id=32170

Fixed in cvs head.  Thanks!
Log in (anonymous is fine) to add a comment.