summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclIOUtil.c3
-rw-r--r--unix/tclUnixFile.c12
-rw-r--r--win/tclWinFile.c40
4 files changed, 45 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index d5623e5..1a8cf94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-07-19 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tclIOUtil.c: fix to GetFilesystemRecord
+ * win/tclWinFile.c:
+ * unix/tclUnixFile.c: fix to subtle problem with links shown
+ up by latest tclkit builds.
+
2002-07-19 Mo DeJong <mdejong@users.sourceforge.net>
* unix/configure:
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index ab0da46..242a692 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.60 2002/07/19 12:31:10 dkf Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.61 2002/07/20 01:01:41 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -4908,6 +4908,7 @@ GetFilesystemRecord(fromFilesystem, epoch)
*epoch = theFilesystemEpoch;
break;
}
+ fsRecPtr = fsRecPtr->nextPtr;
}
FsReleaseIterator();
return fsRecPtr;
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 4c4dfa0..3105d21 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFile.c,v 1.26 2002/07/19 12:31:10 dkf Exp $
+ * RCS: @(#) $Id: tclUnixFile.c,v 1.27 2002/07/20 01:01:41 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -687,7 +687,7 @@ TclpReadlink(path, linkPtr)
Tcl_ExternalToUtfDString(NULL, link, length, linkPtr);
return Tcl_DStringValue(linkPtr);
#else
- return NULL;
+ return NULL;
#endif
}
@@ -765,7 +765,8 @@ TclpObjLink(pathPtr, toPtr, linkAction)
char link[MAXPATHLEN];
int length;
char *native;
-
+ Tcl_DString ds;
+
if (Tcl_FSGetTranslatedPath(NULL, pathPtr) == NULL) {
return NULL;
}
@@ -782,7 +783,10 @@ TclpObjLink(pathPtr, toPtr, linkAction)
strncpy(native, link, (unsigned)length);
native[length] = '\0';
- linkPtr = Tcl_FSNewNativePath(&tclNativeFilesystem, native);
+ Tcl_ExternalToUtfDString(NULL, native, length, &ds);
+ linkPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds));
+ Tcl_DStringFree(&ds);
if (linkPtr != NULL) {
Tcl_IncrRefCount(linkPtr);
}
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 31dca87..04c5fa8 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFile.c,v 1.38 2002/07/19 12:31:10 dkf Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.39 2002/07/20 01:01:41 vincentdarley Exp $
*/
//#define _WIN32_WINNT 0x0500
@@ -452,19 +452,35 @@ WinReadLinkDirectory(LinkDirectory)
case 0x80000000|IO_REPARSE_TAG_SYMBOLIC_LINK:
case IO_REPARSE_TAG_SYMBOLIC_LINK:
case IO_REPARSE_TAG_MOUNT_POINT: {
- int len;
- ClientData clientData;
Tcl_Obj *retVal;
+ Tcl_DString ds;
+ CONST char *copy;
+ int len;
- len = reparseBuffer->SymbolicLinkReparseBuffer.SubstituteNameLength
- + sizeof(WCHAR);
- clientData = (ClientData)ckalloc(len);
- memcpy((VOID*)clientData,
- (VOID*)reparseBuffer->SymbolicLinkReparseBuffer.PathBuffer,
- len);
-
- retVal = Tcl_FSNewNativePath(&tclNativeFilesystem, clientData);
+ Tcl_WinTCharToUtf(
+ (CONST char*)reparseBuffer->SymbolicLinkReparseBuffer.PathBuffer,
+ (int)reparseBuffer->SymbolicLinkReparseBuffer.SubstituteNameLength,
+ &ds);
+
+ copy = Tcl_DStringValue(&ds);
+ len = Tcl_DStringLength(&ds);
+ /*
+ * Certain native path representations on Windows have this special
+ * prefix to indicate that they are to be treated specially. For
+ * example extremely long paths, or symlinks
+ */
+ if (*copy == '\\') {
+ if (0 == strncmp(copy,"\\??\\",4)) {
+ copy += 4;
+ len -= 4;
+ } else if (0 == strncmp(copy,"\\\\?\\",4)) {
+ copy += 4;
+ len -= 4;
+ }
+ }
+ retVal = Tcl_NewStringObj(copy,len);
Tcl_IncrRefCount(retVal);
+ Tcl_DStringFree(&ds);
return retVal;
}
}
@@ -1362,7 +1378,7 @@ TclpReadlink(path, linkPtr)
Tcl_DStringFree(&ds);
if (length < 0) {
- return NULL;
+ return NULL;
}
Tcl_ExternalToUtfDString(NULL, link, length, linkPtr);