Check-in [ac3b922388]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge to kennykb-numerics-branch-20041202a
Timelines: family | ancestors | descendants | both | kennykb-numerics-branch
Files: files | file ages | folders
SHA1: ac3b9223881b0228d4ebb72fd3a5a8a8465c73eb
User & Date: kennykb 2004-12-02 19:24:12.000
Original Comment: merge to kennykb-numerics-branch-20041202a
Context
2004-12-08
18:24
merged with kennykb-numerics-branch-20041208 check-in: ab2eb12a79 user: kennykb tags: kennykb-numerics-branch
2004-12-02
19:24
merge to kennykb-numerics-branch-20041202a check-in: ac3b922388 user: kennykb tags: kennykb-numerics-branch
15:31
Remove a global mutex/state by using lists instead of hashtables to store the collection of aliases ... check-in: ad35750c6d user: dkf tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to ChangeLog.












1
2
3
4
5
6
7












2004-12-02  Donal K. Fellows  <donal.k.fellows@man.ac.uk>

	* generic/tclInterp.c (Alias,Target,Master): Rewrote these so that
	the aliases that refer to an interpreter are stored in a list and
	not a hashtable (which was only ever a convenience, and forced the
	use of a global mutex to generate keys!) [FRQ 1077210]
	* generic/tclNamesp.c (numNsCreated): Moved into thread-local
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2004-12-02  Vince Darley  <vincentdarley@users.sourceforge.net>

	* generic/tclPathObj.c: fix and new tests for [Bug 1074671] to
	* tests/fileSystem.test:   ensure tilde paths are not returned
	specially by 'glob'.

2004-12-02  Kevin B. Kenny  <kennykb@acm.org>

	* win/Makefile.in: Added a 'sed' in the setting of ROOT_DIR_NATIVE
	to compensate for a bug in cygpath (at least version 1.36) that
	leaves a trailing backslash on the end of the converted path.
	
2004-12-02  Donal K. Fellows  <donal.k.fellows@man.ac.uk>

	* generic/tclInterp.c (Alias,Target,Master): Rewrote these so that
	the aliases that refer to an interpreter are stored in a list and
	not a hashtable (which was only ever a convenience, and forced the
	use of a global mutex to generate keys!) [FRQ 1077210]
	* generic/tclNamesp.c (numNsCreated): Moved into thread-local
Changes to generic/tclPathObj.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tclPathObj.c --
 *
 *	This file contains the implementation of Tcl's "path" object
 *	type used to represent and manipulate a general (virtual)
 *	filesystem entity in an efficient manner.
 *
 * Copyright (c) 2003 Vince Darley.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclPathObj.c,v 1.38 2004/11/22 12:53:06 vincentdarley Exp $
 */

#include "tclInt.h"
#include "tclFileSystem.h"

/*
 * Prototypes for procedures defined later in this file.












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tclPathObj.c --
 *
 *	This file contains the implementation of Tcl's "path" object
 *	type used to represent and manipulate a general (virtual)
 *	filesystem entity in an efficient manner.
 *
 * Copyright (c) 2003 Vince Darley.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclPathObj.c,v 1.38.2.1 2004/12/02 19:24:14 kennykb Exp $
 */

#include "tclInt.h"
#include "tclFileSystem.h"

/*
 * Prototypes for procedures defined later in this file.
1228
1229
1230
1231
1232
1233
1234






1235
1236
1237
1238
1239
1240
1241
 *      Only for internal use.
 *      
 *      Takes a path and a directory, where we _assume_ both path and
 *      directory are absolute, normalized and that the path lies
 *      inside the directory.  Returns a Tcl_Obj representing filename 
 *      of the path relative to the directory.
 *      






 * Results:
 *      NULL on error, otherwise a valid object, typically with
 *      refCount of zero, which it is assumed the caller will
 *      increment.
 *
 * Side effects:
 *	The old representation may be freed, and new memory allocated.







>
>
>
>
>
>







1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
 *      Only for internal use.
 *      
 *      Takes a path and a directory, where we _assume_ both path and
 *      directory are absolute, normalized and that the path lies
 *      inside the directory.  Returns a Tcl_Obj representing filename 
 *      of the path relative to the directory.
 *      
 *      In the case where the resulting path would start with a '~', we
 *      take special care to return an ordinary string.  This means to
 *      use that path (and not have it interpreted as a user name),
 *      one must prepend './'.  This may seem strange, but that is how
 *      'glob' is currently defined.
 *      
 * Results:
 *      NULL on error, otherwise a valid object, typically with
 *      refCount of zero, which it is assumed the caller will
 *      increment.
 *
 * Side effects:
 *	The old representation may be freed, and new memory allocated.
1268
1269
1270
1271
1272
1273
1274










1275
1276
1277
1278
1279
1280
1281
				    "string representation", (char *) NULL);
			}
			return NULL;
		    }
		    pathPtr->typePtr->updateStringProc(pathPtr);
		}
		TclFreeIntRep(pathPtr);










	    }

	    fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath));

	    /* Circular reference, by design */
	    fsPathPtr->translatedPathPtr = pathPtr;
	    fsPathPtr->normPathPtr = NULL;







>
>
>
>
>
>
>
>
>
>







1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
				    "string representation", (char *) NULL);
			}
			return NULL;
		    }
		    pathPtr->typePtr->updateStringProc(pathPtr);
		}
		TclFreeIntRep(pathPtr);
	    }
	    /* Now pathPtr is a string object */
	    
	    if (Tcl_GetString(pathPtr)[0] == '~') {
		/* 
		 * If the first character of the path is a tilde,
		 * we must just return the path as is, to agree
		 * with the defined behaviour of 'glob'.
		 */
		return pathPtr;
	    }

	    fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath));

	    /* Circular reference, by design */
	    fsPathPtr->translatedPathPtr = pathPtr;
	    fsPathPtr->normPathPtr = NULL;
Changes to tests/fileSystem.test.
916
917
918
919
920
921
922



















































923
924
925
926
927
928
test filesystem-9.6 {path objects and file tail and object rep} {winOnly} {
    set res {}
    set p "C:\\toto"
    lappend res [file join $p toto]
    file isdirectory $p
    lappend res [file join $p toto]
} {C:/toto/toto C:/toto/toto}




















































cleanupTests
unset -nocomplain drive
}
namespace delete ::tcl::test::fileSystem
return







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
test filesystem-9.6 {path objects and file tail and object rep} {winOnly} {
    set res {}
    set p "C:\\toto"
    lappend res [file join $p toto]
    file isdirectory $p
    lappend res [file join $p toto]
} {C:/toto/toto C:/toto/toto}
test filesystem-9.7 {path objects and glob and file tail and tilde} {
    set res {}
    set origdir [pwd]
    cd [tcltest::temporaryDirectory]
    file mkdir tilde
    close [open tilde/~testNotExist w]
    cd tilde
    set file [lindex [glob *test*] 0]
    lappend res [file exists $file] [catch {file tail $file} r] $r
    lappend res $file
    lappend res [file exists $file] [catch {file tail $file} r] $r
    lappend res [catch {file tail $file} r] $r
    cd ..
    file delete -force tilde
    cd $origdir
    set res
} {0 1 {user "testNotExist" doesn't exist} ~testNotExist 0 1 {user "testNotExist" doesn't exist} 1 {user "testNotExist" doesn't exist}}
test filesystem-9.8 {path objects and glob and file tail and tilde} {
    set res {}
    set origdir [pwd]
    cd [tcltest::temporaryDirectory]
    file mkdir tilde
    close [open tilde/~testNotExist w]
    cd tilde
    set file1 [lindex [glob *test*] 0]
    set file2 "~testNotExist"
    lappend res $file1 $file2
    lappend res [catch {file tail $file1} r] $r
    lappend res [catch {file tail $file2} r] $r
    cd ..
    file delete -force tilde
    cd $origdir
    set res
} {~testNotExist ~testNotExist 1 {user "testNotExist" doesn't exist} 1 {user "testNotExist" doesn't exist}}
test filesystem-9.9 {path objects and glob and file tail and tilde} {
    set res {}
    set origdir [pwd]
    cd [tcltest::temporaryDirectory]
    file mkdir tilde
    close [open tilde/~testNotExist w]
    cd tilde
    set file1 [lindex [glob *test*] 0]
    set file2 "~testNotExist"
    lappend res [catch {file exists $file1} r] $r
    lappend res [catch {file exists $file2} r] $r
    lappend res [string equal $file1 $file2]
    cd ..
    file delete -force tilde
    cd $origdir
    set res
} {0 0 0 0 1}

cleanupTests
unset -nocomplain drive
}
namespace delete ::tcl::test::fileSystem
return
Changes to win/Makefile.in.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
# RCS: @(#) $Id: Makefile.in,v 1.84 2004/11/29 22:41:58 andreas_kupries Exp $

VERSION = @TCL_VERSION@

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
# RCS: @(#) $Id: Makefile.in,v 1.84.2.1 2004/12/02 19:24:14 kennykb Exp $

VERSION = @TCL_VERSION@

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
COMPAT_DIR		= @srcdir@/../compat

# Converts a POSIX path to a Windows native path.
CYGPATH			= @CYGPATH@

GENERIC_DIR_NATIVE	= $(shell $(CYGPATH) '$(GENERIC_DIR)')
WIN_DIR_NATIVE		= $(shell $(CYGPATH) '$(WIN_DIR)')
ROOT_DIR_NATIVE		= $(shell $(CYGPATH) '$(ROOT_DIR)')

LIBRARY_DIR   = $(shell echo '$(ROOT_DIR_NATIVE)/library' | sed 's/\\/\//g' )

DLLSUFFIX		= @DLLSUFFIX@
LIBSUFFIX		= @LIBSUFFIX@
EXESUFFIX		= @EXESUFFIX@








|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
COMPAT_DIR		= @srcdir@/../compat

# Converts a POSIX path to a Windows native path.
CYGPATH			= @CYGPATH@

GENERIC_DIR_NATIVE	= $(shell $(CYGPATH) '$(GENERIC_DIR)')
WIN_DIR_NATIVE		= $(shell $(CYGPATH) '$(WIN_DIR)')
ROOT_DIR_NATIVE		= $(shell $(CYGPATH) '$(ROOT_DIR)' | sed 's/\\*$$//' )

LIBRARY_DIR   = $(shell echo '$(ROOT_DIR_NATIVE)/library' | sed 's/\\/\//g' )

DLLSUFFIX		= @DLLSUFFIX@
LIBSUFFIX		= @LIBSUFFIX@
EXESUFFIX		= @EXESUFFIX@