Artifacts Associated With Ticket 218213ffffffffff
Ticket change [c125b495c3] (rid 111276) by nobody on 2000-10-26 00:54:35:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2531 Bug Version: 8.0.3 SubmitDate: '1999-08-12' LastModified: '1999-12-03' Severity: MED Status: Closed Submitter: techsupp ChangedBy: hobbs OS: Windows 95 OSVersion: original release (not OSR2) Machine: X86 FixedDate: '2000-10-25' ClosedDate: '1999-12-03' Name: James Bonfield Extensions: Home made extensions... CustomShell: None. Comments: This fix removes the / to \ filename conversion. As the code itself documented, this conversion is necessary for some system interfaces. Which? I suspect this is old code dealing with the Win32s version, which is now dead and burried. Our Win95 machine (first release - not OSR2) works fine with forward slashes. Indeed as we have seen it works better with forward slashes than with backward slashes! Windows 98 has the same system bug, although it's been fixed in NT. I realise that this is not a Tcl bug. The Tcl open code internally appears to use different windows interfaces, which do not get stumped by this bug. However the bug makes it hard to add existing code onto a Tcl interpreter. (It's not always practical to rewrite masses of old code to use the Tcl channel functions.) This same code is in tcl8.2b1, so I expect the problem also arises there. Indeed the patch above was made against that release. ReproducibleScript: Changing the current working directory to a directory with //hostname/dir syntax will then cause the Windows open() system call to return errors. This is a Windows bug, but it is only triggered when using \\hostname\dir notation. Unfortunately the Tcl library automatically converts / into \. Eg: % cd c: % trace_type //arran/jkb/a.scf SCF % cd //arran/jkb % trace_type //arran/jkb/a.scf UNK % Here, trace_type is our own function, which calls open() directly. The current working directory has a direct impact on whether this works, even though we specify a full pathname! The following C program demonstrates the problem. /* --------------------------------------------------------- */ #include "windows.h" #include "direct.h" #include <io.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> main(int argc,char *argv[]) { int drv; char buf[100]; int fd; if(argc < 1){ printf("No directory specified\n"); return 1; } drv=_getdrive(); printf("drive before is %d\n",drv); printf("changing to dir \"%s\"\n",argv[1]); SetCurrentDirectory(argv[1]); GetCurrentDirectory(100,buf); printf("drive is set to: %s\n",buf); drv=_getdrive(); printf("drive after is %d\n",drv); // _chdrive(3); fd = _open("//arran/jkb/a.scf", O_RDONLY); if( fd > 0 ) printf("open succeeded\n"); else printf("open failed, errno=%d",errno); _read(fd,buf,100); printf("got %s\n",buf); return 0; } /* ----------------------------------------------------------- */ Compiling this up on Win95 as drv.exe, we can try: c:\> drv //arran/jkb drive before is 3 changing dir to "//arran/jkb" drive is set to: C:\\arran\jkb drive after is 3 open succeeded got filecontents c:\> drv \\arran\jkb drive before is 3 changing dir to "\\arran\jkb" drive is set to: \\arran\jkb drive after is 0 open failed, errno=2 An alternative fix is for us to directly call _chdrive(3); before the open if (and only if) the pathname starts with //. ObservedBehavior: Full pathnames given to the C open() function should not be dependent on your current working directory. DesiredBehavior: Our trace_type function should work fine regardless of directory. Patch: *** tclFileName.c.orig Fri Aug 6 11:18:12 1999 --- tclFileName.c Fri Aug 6 11:18:43 1999 *************** *** 1006,1023 **** Tcl_JoinPath(1, &name, bufferPtr); } - /* - * Convert forward slashes to backslashes in Windows paths because - * some system interfaces don't accept forward slashes. - */ - - if (tclPlatform == TCL_PLATFORM_WINDOWS) { - for (p = Tcl_DStringValue(bufferPtr); *p != '\0'; p++) { - if (*p == '/') { - *p = '\\'; - } - } - } return Tcl_DStringValue(bufferPtr); } --- 1006,1011 ---- PatchFiles: tclFileName.c One system interface which still requires \'s is LoadLibrary. This user will have to work within the confines set, and perhaps a util routine to convert back easily at the C level would be good. -- 12/03/1999 hobbs - foundin initialized to: "obsolete: 8.0.3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "37. File System"
- title initialized to: "Windows pathname bug with \\nethost\dir names"
- type initialized to: "Bug"
Ticket change [2e866e655e] (rid 119240) by welch on 2000-10-26 08:16:57:
- closedate changed to: "2000-10-26T01:16:57"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [1a070a7b03] (rid 122904) by dgp on 2001-04-14 02:24:37:
- closedate changed to: "2001-04-13T19:24:37"
- closer changed to: "dgp"
- subsystem changed to: "36. Pathname Management"