Tcl Source Code

Check-in [77f44a0961]
Login

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

Overview
Comment:[Bug 2935503] Incorrect mode field returned by file stat command
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 77f44a0961be6a944adedbdaa141fccd01430d31
User & Date: jan.nijtmans 2011-10-11 13:19:54
Context
2011-10-13
07:56
revert test-case change from [Bug 2935503] check-in: 80c27dee1f user: jan.nijtmans tags: core-8-4-branch
2011-10-11
13:29
[Bug 2935503] Incorrect mode field returned by file stat command check-in: c865669b6f user: jan.nijtmans tags: core-8-5-branch
13:19
[Bug 2935503] Incorrect mode field returned by file stat command check-in: 77f44a0961 user: jan.nijtmans tags: core-8-4-branch
2011-10-07
20:54
Fix env.test, when running under wine 1.3 (partly backported from Tcl 8.6) check-in: 951880c457 user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2011-10-07  Jan Nijtmans  <[email protected]>

	* win/tclWinChan.c:    Fix various gcc warnings
	* win/tclWinConsole.c: (discovered with latest
	* win/tclWinNotify.c:  mingw, based on gcc 4.6.1)
	* win/tclWinReg.c:
	* tests/env.test:      Fix env.test, when running
>
>
>
>
>







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

	* win/tclWinFile.c:    [Bug 2935503] Incorrect mode field
	* tests/io.test:       returned by file stat command

2011-10-07  Jan Nijtmans  <[email protected]>

	* win/tclWinChan.c:    Fix various gcc warnings
	* win/tclWinConsole.c: (discovered with latest
	* win/tclWinNotify.c:  mingw, based on gcc 4.6.1)
	* win/tclWinReg.c:
	* tests/env.test:      Fix env.test, when running

Changes to tests/io.test.

5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
    set x [gets $f]
    close $f
    set f [open $path(test3) r]
    lappend x [gets $f]
    close $f
    set x
} {zzy abzzy}
test io-40.2 {POSIX open access modes: CREAT} {unixOnly} {
    file delete $path(test3)
    set f [open $path(test3) {WRONLY CREAT} 0600]
    file stat $path(test3) stats
    set x [format "0%o" [expr $stats(mode)&0777]]
    puts $f "line 1"
    close $f
    set f [open $path(test3) r]
    lappend x [gets $f]
    close $f
    set x
} {0600 {line 1}}

# some tests can only be run is umask is 2
# if "umask" cannot be run, the tests will be skipped.
catch {testConstraint umask2 [expr {[exec umask] == 2}]}

test io-40.3 {POSIX open access modes: CREAT} {unixOnly umask2} {
    # This test only works if your umask is 2, like ouster's.







|

|








|







5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
    set x [gets $f]
    close $f
    set f [open $path(test3) r]
    lappend x [gets $f]
    close $f
    set x
} {zzy abzzy}
test io-40.2 {POSIX open access modes: CREAT} {
    file delete $path(test3)
    set f [open $path(test3) {WRONLY CREAT} 0666]
    file stat $path(test3) stats
    set x [format "0%o" [expr $stats(mode)&0777]]
    puts $f "line 1"
    close $f
    set f [open $path(test3) r]
    lappend x [gets $f]
    close $f
    set x
} {0666 {line 1}}

# some tests can only be run is umask is 2
# if "umask" cannot be run, the tests will be skipped.
catch {testConstraint umask2 [expr {[exec umask] == 2}]}

test io-40.3 {POSIX open access modes: CREAT} {unixOnly umask2} {
    # This test only works if your umask is 2, like ouster's.

Changes to win/tclWinFile.c.

1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
 * 
 * NativeMatchType --
 * 
 * This function needs a special case for a path which is a root
 * volume, because for NTFS root volumes, the getFileAttributesProc
 * returns a 'hidden' attribute when it should not.
 * 
 * We never make any calss to a 'get attributes' routine here,
 * since we have arranged things so that our caller already knows
 * such information.
 * 
 * Results:
 *  0 = file doesn't match
 *  1 = file matches
 * 







|







1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
 * 
 * NativeMatchType --
 * 
 * This function needs a special case for a path which is a root
 * volume, because for NTFS root volumes, the getFileAttributesProc
 * returns a 'hidden' attribute when it should not.
 * 
 * We never make any calls to a 'get attributes' routine here,
 * since we have arranged things so that our caller already knows
 * such information.
 * 
 * Results:
 *  0 = file doesn't match
 *  1 = file matches
 * 
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
    }
    
    /*
     * Propagate the S_IREAD, S_IWRITE, S_IEXEC bits to the group and 
     * other positions.
     */

    mode |= (mode & 0x0700) >> 3;
    mode |= (mode & 0x0700) >> 6;
    return (unsigned short)mode;
}

/*
 *------------------------------------------------------------------------
 *
 * ToCTime --







|
|







2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
    }
    
    /*
     * Propagate the S_IREAD, S_IWRITE, S_IEXEC bits to the group and 
     * other positions.
     */

    mode |= (mode & (S_IREAD|S_IWRITE|S_IEXEC)) >> 3;
    mode |= (mode & (S_IREAD|S_IWRITE|S_IEXEC)) >> 6;
    return (unsigned short)mode;
}

/*
 *------------------------------------------------------------------------
 *
 * ToCTime --