Tcl Source Code

View Ticket
Login
Ticket UUID: 528284
Title: Fix filesystem crashed under win98
Type: Patch Version: None
Submitter: mdejong Created on: 2002-03-10 23:52:46
Subsystem: 37. File System Assigned To: hobbs
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2002-03-12 18:34:24
Resolution: Accepted Closed By: mdejong
    Closed on: 2002-03-12 11:34:24
Description:
I noticed that Tcl is not able to make it through
the tests in winFCmd.test without crashing or
going into an infinite loop under Windows 98.

I created this patch, which fixes the crashes
and returns ENOENT when a path like "" is
passed in. The comments for these functions
state that ENOENT should be returned, but I
am not sure that jives with the test cases
in winFCmd.test. I would ask that someone
run the tests in winFCmd.test under NT to
see if this patch changes any of the test
results. Further changes to the expected
test results may be needed, but I am not sure
how the 98/NT thing plays into it just now.

Also, this patch changes a check that looked
like so:

if (tclWinProcs->useWide) {
  if (((WCHAR *) nativePath)[0] == '\0') {
    Tcl_SetErrno(ENOENT);
      return TCL_ERROR;
  }
} else {
  if (((char *) nativePath)[0] == '\0') {
    Tcl_SetErrno(ENOENT);
    return TCL_ERROR;
  }
}

to:

if (nativePath == NULL || nativePath[0] == '\0') {
  Tcl_SetErrno(ENOENT);
  return TCL_ERROR;
}


I could not see any reason to make this extra
useWide check, so I took a peek at the generated
ASM:

9:            cond = ((WCHAR *) path[0] == '\0');
0040102A   mov         eax,dword ptr [path]
0040102D   movsx       ecx,byte ptr [eax]
00401030   neg         ecx
00401032   sbb         ecx,ecx
00401034   inc         ecx
00401035   mov         dword ptr [cond],ecx
10:       } else {
00401038   jmp         main+38h (00401048)
11:           cond = ((char *) path[0] == '\0');
0040103A   mov         edx,dword ptr [path]
0040103D   movsx       eax,byte ptr [edx]
00401040   neg         eax
00401042   sbb         eax,eax
00401044   inc         eax
00401045   mov         dword ptr [cond],eax

The code certainly looks exactly the same,
except for the registers that are used.
Since I could not come up with any reason
for this extra complexity, I removed it.
User Comments: mdejong added on 2002-03-12 18:34:24:
Logged In: YES 
user_id=90858

I looked over the winFCmd.test tests that were failing
under 98 and I am convinced they have nothing to do
with this "" patch. I will create another patch to
deal with them. Added to CVS on 2002-03-11.

nobody added on 2002-03-11 21:21:37:
Logged In: NO 

The patch looks good to me -- feel free to apply 
-- Vince.

mdejong added on 2002-03-11 06:52:46:

File Added - 19130: win_fs.patch

Attachments: