From 3eb2fa20dcdf1e70f6d66550789099af2e79ca57 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Jun 2015 13:04:09 +0000 Subject: If the file system changes when "cwd" changes, force a filesystem refresh on path objects. Needed for AndroWish/TclKit (???) in obscure situations, harmless on systems which only have a single native filesystem. --- generic/tclIOUtil.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index d2919fc..06e1b32 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -2890,9 +2890,13 @@ int Tcl_FSChdir( Tcl_Obj *pathPtr) { - const Tcl_Filesystem *fsPtr; + const Tcl_Filesystem *fsPtr, *oldFsPtr = NULL; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey); int retVal = -1; + if (tsdPtr->cwdPathPtr != NULL) { + oldFsPtr = Tcl_FSGetFileSystemForPath(tsdPtr->cwdPathPtr); + } if (Tcl_FSGetNormalizedPath(NULL, pathPtr) == NULL) { Tcl_SetErrno(ENOENT); return retVal; @@ -2992,7 +2996,6 @@ Tcl_FSChdir( * instead. This should be examined by someone on Unix. */ - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey); ClientData cd; ClientData oldcd = tsdPtr->cwdClientData; @@ -3009,6 +3012,14 @@ Tcl_FSChdir( } else { FsUpdateCwd(normDirName, NULL); } + + /* + * If the filesystem changed between old and new cwd + * force filesystem refresh on path objects. + */ + if (oldFsPtr != NULL && fsPtr != oldFsPtr) { + Tcl_FSMountsChanged(NULL); + } } return retVal; @@ -3150,7 +3161,7 @@ TclSkipUnlink (Tcl_Obj* shlibFile) * * Ad 2: This variable can disable/override the AUFS detection, i.e. for * testing if a newer AUFS does not have the bug any more. - * + * * Ad 3: This is conditionally compiled in. Condition currently must be set manually. * This part needs proper tests in the configure(.in). */ @@ -3460,7 +3471,7 @@ Tcl_LoadFile( return retVal; resolveSymbols: - /* + /* * At this point, *handlePtr is already set up to the handle for the * loaded library. We now try to resolve the symbols. */ @@ -3469,7 +3480,7 @@ Tcl_LoadFile( for (i=0 ; symbols[i] != NULL; i++) { procPtrs[i] = Tcl_FindSymbol(interp, *handlePtr, symbols[i]); if (procPtrs[i] == NULL) { - /* + /* * At least one symbol in the list was not found. Unload the * file, and report the problem back to the caller. * (Tcl_FindSymbol should already have left an appropriate @@ -3489,7 +3500,7 @@ Tcl_LoadFile( *---------------------------------------------------------------------- * * DivertFindSymbol -- - * + * * Find a symbol in a shared library loaded by copy-from-VFS. * *---------------------------------------------------------------------- -- cgit v0.12