Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 49371573a6be91420cd1ea3f117080b18e67edcd
Ticket: 747575ffffffffffffffffffffffffffffffffff
WinNT - [file rename] incorrect error message
User & Date: jgodfrey on 2003-06-02 15:01:30
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    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...
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "jgodfrey"
  9. subsystem changed to: "17. Commands I-L"
  10. title changed to: "WinNT - [file rename] incorrect error message"
  11. type changed to: "Bug"