Tcl Source Code

Check-in [dfd98db64f]
Login

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

Overview
Comment:[Bug #1536227]: Cygwin network pathname supoort
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dfd98db64fce90296b4856c84948d9efc3aa19b8
User & Date: jan.nijtmans 2012-08-08 10:00:10
Context
2012-08-08
23:07
Change one '#ifdef' to '#if defined()' for improved consistency within the file. check-in: 211aa43013 user: stwo tags: trunk
20:30
merge trunk check-in: ddf95e5e5d user: dgp tags: core-8-6-b3-rc
10:32
merge trunk check-in: 27388707f2 user: jan.nijtmans tags: frq-3527238
10:00
[Bug #1536227]: Cygwin network pathname supoort check-in: dfd98db64f user: jan.nijtmans tags: trunk
09:25
[Bug #1536227]: Cygwin network pathname supoort check-in: b43269edb8 user: jan.nijtmans tags: core-8-5-branch
2012-08-07
20:57
Minor changes to improve style (C89 declarations, consistent indentation, clarification of #endifs, ... check-in: 3995dbcf90 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2012-08-07  Don Porter  <[email protected]>

	* generic/tclIOUtil.c:	[Bug 3554250] Overlooked one field of
	cleanup in the thread exit handler for the filesystem subsystem.

2012-07-31  Donal K. Fellows  <[email protected]>

>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2012-08-08  Jan Nijtmans  <[email protected]>

	* generic/tclfileName.c: [Bug #1536227]: Cygwin network pathname
	* tests/fileName.test:   support

2012-08-07  Don Porter  <[email protected]>

	* generic/tclIOUtil.c:	[Bug 3554250] Overlooked one field of
	cleanup in the thread exit handler for the filesystem subsystem.

2012-07-31  Donal K. Fellows  <[email protected]>

Changes to generic/tclFileName.c.

407
408
409
410
411
412
413


414
415
416
417
418
419
420
421
422
423






424



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
	case TCL_PLATFORM_UNIX: {
	    const char *origPath = path;

	    /*
	     * Paths that begin with / are absolute.
	     */



#ifdef __QNX__
	    /*
	     * Check for QNX //<node id> prefix
	     */
	    if (*path && (pathLen > 3) && (path[0] == '/')
		    && (path[1] == '/') && isdigit(UCHAR(path[2]))) {
		path += 3;
		while (isdigit(UCHAR(*path))) {
		    path++;
		}






	    }



#endif
	    if (path[0] == '/') {
#ifdef __CYGWIN__
		/*
		 * Check for Cygwin // network path prefix
		 */
		if (path[1] == '/') {
		    path++;
		}
#endif
		if (driveNameLengthPtr != NULL) {
		    /*
		     * We need this addition in case the QNX or Cygwin code was used.
		     */

		    *driveNameLengthPtr = (1 + path - origPath);
		}
	    } else {
		type = TCL_PATH_RELATIVE;
	    }
	    break;
	}
	case TCL_PLATFORM_WINDOWS: {







>
>
|
|
|
|
<
|
|
|
|
|
>
>
>
>
>
>
|
>
>
>

<
<
<
<
<
<
<







|







407
408
409
410
411
412
413
414
415
416
417
418
419

420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435







436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
	case TCL_PLATFORM_UNIX: {
	    const char *origPath = path;

	    /*
	     * Paths that begin with / are absolute.
	     */

	    if (path[0] == '/') {
		++path;
#if defined(__CYGWIN__) || defined(__QNX__)
		/*
		 * Check for "//" network path prefix
		 */

		if ((*path == '/') && path[1] && (path[1] != '/')) {
		    path += 2;
		    while (*path && *path != '/') {
			++path;
		    }
#if defined(__CYGWIN__)
		    /* UNC paths need to be followed by a share name */
		    if (*path++ && (*path && *path != '/')) {
			++path;
			while (*path && *path != '/') {
			    ++path;
			}
		    } else {
			path = origPath + 1;
		    }
#endif







		}
#endif
		if (driveNameLengthPtr != NULL) {
		    /*
		     * We need this addition in case the QNX or Cygwin code was used.
		     */

		    *driveNameLengthPtr = (path - origPath);
		}
	    } else {
		type = TCL_PATH_RELATIVE;
	    }
	    break;
	}
	case TCL_PLATFORM_WINDOWS: {
636
637
638
639
640
641
642
643
644
645
646
647
648
649



650
651
652
653




654


655
656
657
658
659
660


661
662
663
664
665
666
667
668
669
670
671

672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
 */

static Tcl_Obj *
SplitUnixPath(
    const char *path)		/* Pointer to string containing a path. */
{
    int length;
    const char *p, *elementStart;
    Tcl_Obj *result = Tcl_NewObj();

    /*
     * Deal with the root directory as a special case.
     */




#ifdef __QNX__
    /*
     * Check for QNX //<node id> prefix
     */







    if ((path[0] == '/') && (path[1] == '/')
	    && isdigit(UCHAR(path[2]))) { /* INTL: digit */
	path += 3;
	while (isdigit(UCHAR(*path))) { /* INTL: digit */
	    path++;
	}


    }
#endif

    p = path;
    if (*p == '/') {
	Tcl_Obj *rootElt = Tcl_NewStringObj("/", 1);
	p++;
#ifdef __CYGWIN__
	/*
	 * Check for Cygwin // network path prefix
	 */

	if (*p == '/') {
	    Tcl_AppendToObj(rootElt, "/", 1);
	    p++;
	}
#endif
	Tcl_ListObjAppendElement(NULL, result, rootElt);
    }

    /*
     * Split on slashes. Embedded elements that start with tilde will be
     * prefixed with "./" so they are not affected by tilde substitution.
     */

    for (;;) {
	elementStart = p;
	while ((*p != '\0') && (*p != '/')) {
	    p++;
	}
	length = p - elementStart;
	if (length > 0) {
	    Tcl_Obj *nextElt;
	    if ((elementStart[0] == '~') && (elementStart != path)) {
		TclNewLiteralStringObj(nextElt, "./");
		Tcl_AppendToObj(nextElt, elementStart, length);
	    } else {
		nextElt = Tcl_NewStringObj(elementStart, length);
	    }
	    Tcl_ListObjAppendElement(NULL, result, nextElt);
	}
	if (*p++ == '\0') {
	    break;
	}
    }
    return result;
}

/*







|






>
>
>
|
|
|
|
>
>
>
>
|
>
>
|
<
|
|
|
|
>
>
|

|
<
|
|
<
<
<
<
<
>
|
<
|

<
<








|
|
|

|


|







|







639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667

668
669
670
671
672
673
674
675
676

677
678





679
680

681
682


683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
 */

static Tcl_Obj *
SplitUnixPath(
    const char *path)		/* Pointer to string containing a path. */
{
    int length;
    const char *origPath = path, *elementStart;
    Tcl_Obj *result = Tcl_NewObj();

    /*
     * Deal with the root directory as a special case.
     */

    if (*path == '/') {
	Tcl_Obj *rootElt;
	++path;
#if defined(__CYGWIN__) || defined(__QNX__)
	/*
	 * Check for "//" network path prefix
	 */
	if ((*path == '/') && path[1] && (path[1] != '/')) {
	    path += 2;
	    while (*path && *path != '/') {
		++path;
	    }
#if defined(__CYGWIN__)
	    /* UNC paths need to be followed by a share name */
	    if (*path++ && (*path && *path != '/')) {

		++path;
		while (*path && *path != '/') {
		    ++path;
		}
	    } else {
		path = origPath + 1;
	    }
#endif
	}

#endif
	rootElt = Tcl_NewStringObj(origPath, path - origPath);





	Tcl_ListObjAppendElement(NULL, result, rootElt);
	while (*path == '/') {

	    ++path;
	}


    }

    /*
     * Split on slashes. Embedded elements that start with tilde will be
     * prefixed with "./" so they are not affected by tilde substitution.
     */

    for (;;) {
	elementStart = path;
	while ((*path != '\0') && (*path != '/')) {
	    path++;
	}
	length = path - elementStart;
	if (length > 0) {
	    Tcl_Obj *nextElt;
	    if ((elementStart[0] == '~') && (elementStart != origPath)) {
		TclNewLiteralStringObj(nextElt, "./");
		Tcl_AppendToObj(nextElt, elementStart, length);
	    } else {
		nextElt = Tcl_NewStringObj(elementStart, length);
	    }
	    Tcl_ListObjAppendElement(NULL, result, nextElt);
	}
	if (*path++ == '\0') {
	    break;
	}
    }
    return result;
}

/*
1770
1771
1772
1773
1774
1775
1776

1777
1778
1779
1780
1781
1782
1783
	    }
	    pathPrefix = TclDStringToObj(&buffer);
	    Tcl_IncrRefCount(pathPrefix);
	    globFlags |= TCL_GLOBMODE_DIR;
	    if (c != '\0') {
		tail++;
	    }

	} else {
	    tail = pattern;
	}
    } else {
	Tcl_IncrRefCount(pathPrefix);
	tail = pattern;
    }







>







1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
	    }
	    pathPrefix = TclDStringToObj(&buffer);
	    Tcl_IncrRefCount(pathPrefix);
	    globFlags |= TCL_GLOBMODE_DIR;
	    if (c != '\0') {
		tail++;
	    }
	    Tcl_DStringFree(&buffer);
	} else {
	    tail = pattern;
	}
    } else {
	Tcl_IncrRefCount(pathPrefix);
	tail = pattern;
    }

Changes to tests/fileName.test.

195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
test filename-4.12 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split ../..
} {.. ..}
test filename-4.13 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split //foo
} "[file split //] foo"
test filename-4.14 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split foo//bar
} {foo bar}
test filename-4.15 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split ~foo







|







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
test filename-4.12 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split ../..
} {.. ..}
test filename-4.13 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split //foo
} "/ foo"
test filename-4.14 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split foo//bar
} {foo bar}
test filename-4.15 {Tcl_SplitPath: unix} {testsetplatform} {
    testsetplatform unix
    file split ~foo
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
test filename-7.16 {Tcl_JoinPath: unix} {testsetplatform} {
    testsetplatform unix
    file join a . ./~b
} {a/./~b}
test filename-7.17 {Tcl_JoinPath: unix} {testsetplatform} {
    testsetplatform unix
    file join //a b
} "[file split //]a/b"
test filename-7.18 {Tcl_JoinPath: unix} {testsetplatform} {
    testsetplatform unix
    file join /// a b
} "[file split //]a/b"

test filename-9.1 {Tcl_JoinPath: win} {testsetplatform} {
    testsetplatform win
    file join a b
} {a/b}
test filename-9.2 {Tcl_JoinPath: win} {testsetplatform} {
    testsetplatform win







|



|







432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
test filename-7.16 {Tcl_JoinPath: unix} {testsetplatform} {
    testsetplatform unix
    file join a . ./~b
} {a/./~b}
test filename-7.17 {Tcl_JoinPath: unix} {testsetplatform} {
    testsetplatform unix
    file join //a b
} "/a/b"
test filename-7.18 {Tcl_JoinPath: unix} {testsetplatform} {
    testsetplatform unix
    file join /// a b
} "/a/b"

test filename-9.1 {Tcl_JoinPath: win} {testsetplatform} {
    testsetplatform win
    file join a b
} {a/b}
test filename-9.2 {Tcl_JoinPath: win} {testsetplatform} {
    testsetplatform win