Tcl Source Code

Check-in [53a797afe6]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:[Bug 3092089]: [file normalize] can remove path components. [Bug 3587096] win vista/7: "can't find init.tcl" when called via junction.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 53a797afe64fa4dbbb12f273e3e0e8da86ee7bf4
User & Date: jan.nijtmans 2013-01-08 10:13:20
Context
2013-01-09
15:43
Backported [Bug 2882342]: correct struct _REPARSE_DATA_BUFFER in tcl 8.4 check-in: baeaa4f375 user: jan.nijtmans tags: core-8-4-branch
2013-01-08
12:02
merge core-8-4-branch check-in: 43ed2c114b user: jan.nijtmans tags: bug-3562640
10:17
[Bug 3092089]: [file normalize] can remove path components. [Bug 3587096] win vista/7: "can't find i... check-in: 55b5e89e13 user: jan.nijtmans tags: core-8-5-branch
10:13
[Bug 3092089]: [file normalize] can remove path components. [Bug 3587096] win vista/7: "can't find i... check-in: 53a797afe6 user: jan.nijtmans tags: core-8-4-branch
08:44
new attempt for better fix Closed-Leaf check-in: 4fad40532f user: jan.nijtmans tags: bug-3092089
2013-01-07
11:06
Extend the public and private stub tables with dummy NULL entries, up to the size of the Tcl 8.6 stu... check-in: c59364b9c7 user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ChangeLog.

            1  +2013-01-08  Jan Nijtmans  <[email protected]>
            2  +
            3  +	* win/tclWinFile.c: [Bug 3092089]: [file normalize] can remove path
            4  +	components.	[Bug 3587096] win vista/7: "can't find init.tcl" when
            5  +	called via junction.
            6  +
     1      7   2013-01-07  Jan Nijtmans  <[email protected]>
     2      8   
     3      9   	* generic/tcl.decls: Extend the public and private stub tables with
     4     10   	* generic/tclInt.decls: dummy NULL entries, up to the size of the
     5     11   	Tcl 8.6 stub tables. This makes it easier to debug extensions which
     6     12   	use Tcl 8.5/8.6 features but (erroneously) are attempted to be loaded
     7     13   	in Tcl 8.4.

Changes to win/tclWinFile.c.

   177    177    */
   178    178   
   179    179   static int NativeAccess(CONST TCHAR *path, int mode);
   180    180   static int NativeStat(CONST TCHAR *path, Tcl_StatBuf *statPtr, int checkLinks);
   181    181   static unsigned short NativeStatMode(DWORD attr, int checkLinks, int isExec);
   182    182   static int NativeIsExec(CONST TCHAR *path);
   183    183   static int NativeReadReparse(CONST TCHAR* LinkDirectory, 
   184         -			     REPARSE_DATA_BUFFER* buffer);
          184  +			     REPARSE_DATA_BUFFER* buffer, DWORD desiredAccess);
   185    185   static int NativeWriteReparse(CONST TCHAR* LinkDirectory, 
   186    186   			      REPARSE_DATA_BUFFER* buffer);
   187    187   static int NativeMatchType(int isDrive, DWORD attr, CONST TCHAR* nativeName, 
   188    188   			   Tcl_GlobTypeData *types);
   189    189   static int WinIsDrive(CONST char *name, int nameLen);
   190    190   static int WinIsReserved(CONST char *path);
   191    191   static Tcl_Obj* WinReadLink(CONST TCHAR* LinkSource);
................................................................................
   391    391   TclWinSymLinkCopyDirectory(LinkOriginal, LinkCopy)
   392    392       CONST TCHAR* LinkOriginal;  /* Existing junction - reparse point */
   393    393       CONST TCHAR* LinkCopy;      /* Will become a duplicate junction */
   394    394   {
   395    395       DUMMY_REPARSE_BUFFER dummy;
   396    396       REPARSE_DATA_BUFFER *reparseBuffer = (REPARSE_DATA_BUFFER*)&dummy;
   397    397       
   398         -    if (NativeReadReparse(LinkOriginal, reparseBuffer)) {
          398  +    if (NativeReadReparse(LinkOriginal, reparseBuffer, GENERIC_READ)) {
   399    399   	return -1;
   400    400       }
   401    401       return NativeWriteReparse(LinkCopy, reparseBuffer);
   402    402   }
   403    403   
   404    404   /*
   405    405    *--------------------------------------------------------------------
................................................................................
   475    475       REPARSE_DATA_BUFFER *reparseBuffer = (REPARSE_DATA_BUFFER*)&dummy;
   476    476       
   477    477       attr = (*tclWinProcs->getFileAttributesProc)(LinkDirectory);
   478    478       if (!(attr & FILE_ATTRIBUTE_REPARSE_POINT)) {
   479    479   	Tcl_SetErrno(EINVAL);
   480    480   	return NULL;
   481    481       }
   482         -    if (NativeReadReparse(LinkDirectory, reparseBuffer)) {
          482  +    if (NativeReadReparse(LinkDirectory, reparseBuffer, 0)) {
   483    483           return NULL;
   484    484       }
   485    485       
   486    486       switch (reparseBuffer->ReparseTag) {
   487    487   	case 0x80000000|IO_REPARSE_TAG_SYMBOLIC_LINK: 
   488    488   	case IO_REPARSE_TAG_SYMBOLIC_LINK: 
   489    489   	case IO_REPARSE_TAG_MOUNT_POINT: {
................................................................................
   581    581    *
   582    582    * Assumption that LinkDirectory is a valid, existing directory.
   583    583    * 
   584    584    * Returns zero on success.
   585    585    *--------------------------------------------------------------------
   586    586    */
   587    587   static int 
   588         -NativeReadReparse(LinkDirectory, buffer)
          588  +NativeReadReparse(LinkDirectory, buffer, desiredAccess)
   589    589       CONST TCHAR* LinkDirectory;   /* The junction to read */
   590    590       REPARSE_DATA_BUFFER* buffer;  /* Pointer to buffer. Cannot be NULL */
          591  +    DWORD desiredAccess;
   591    592   {
   592    593       HANDLE hFile;
   593    594       DWORD returnedLength;
   594    595      
   595         -    hFile = (*tclWinProcs->createFileProc)(LinkDirectory, GENERIC_READ, 0,
          596  +    hFile = (*tclWinProcs->createFileProc)(LinkDirectory, desiredAccess, 0,
   596    597   	NULL, OPEN_EXISTING, 
   597    598   	FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
   598    599       if (hFile == INVALID_HANDLE_VALUE) {
   599    600   	/* Error creating directory */
   600    601   	TclWinConvertError(GetLastError());
   601    602   	return -1;
   602    603       }