Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2352 WinNT - [file rename] incorrect error message

obsolete: 8.4.2
closed-fixed
Vince Darley
5
2003-06-02
2003-06-02
Jeff Godfrey
No

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...

Discussion

    • labels: 105658 --> 37. File System
    • assigned_to: dkf --> vincentdarley
     
    • milestone: --> obsolete: 8.4.2
     
  • Vince Darley
    Vince Darley
    2003-06-02

    Logged In: YES
    user_id=32170

    Fixed in cvs head. Thanks!

     
  • Vince Darley
    Vince Darley
    2003-06-02

    • status: open --> closed-fixed