Ticket UUID: | 525ccacaef84745d0a5ed72060f208626291077c | |||
Title: | win: strange discrepancy regarding Tcl_FSStat (all file sub-commands using GetStatBuf) corresponding path by "built-in Windows names with dir path and extension" | |||
Type: | Bug | Version: | >= 8.6 | |
Submitter: | sebres | Created on: | 2018-07-13 19:08:21 | |
Subsystem: | 16. Commands A-H | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2018-07-16 14:01:13 | |
Resolution: | Fixed | Closed By: | sebres | |
Closed on: | 2018-07-16 14:01:13 | |||
Description: |
I found very weird discrepancy regarding Tcl_FSStat using 8.6 under Windows for file sub-commands (that use GetStatBuf), depending from used path by "built-in Windows names with dir path and extension". The explanation, what happens, could be provided from this script:
puts [test_fs_nef [info library]]
puts [test_fs_nef [info library] CON.txt]
puts [test_fs_nef $::env(TEMP)]
puts [test_fs_nef $::env(TEMP) CON.txt]; ## here something goes broken!!!
D:/Projects/tcl8.6-upstream/library/CON.txt ...
atime : [1] could not read "D:/Projects/tcl8.6-upstream/library/CON.txt": no such file or directory
mtime : [1] could not read "D:/Projects/tcl8.6-upstream/library/CON.txt": no such file or directory
size : [1] could not read "D:/Projects/tcl8.6-upstream/library/CON.txt": no such file or directory
stat : [1] could not read "D:/Projects/tcl8.6-upstream/library/CON.txt": no such file or directory
type : [1] could not read "D:/Projects/tcl8.6-upstream/library/CON.txt": no such file or directory
C:/Temp/this-file-does-not-exists.txt ...
atime : [1] could not read "C:/Temp/this-file-does-not-exists.txt": no such file or directory
mtime : [1] could not read "C:/Temp/this-file-does-not-exists.txt": no such file or directory
size : [1] could not read "C:/Temp/this-file-does-not-exists.txt": no such file or directory
stat : [1] could not read "C:/Temp/this-file-does-not-exists.txt": no such file or directory
type : [1] could not read "C:/Temp/this-file-does-not-exists.txt": no such file or directory
C:/Temp/CON.txt ...
atime : [1] could not get access time for file "C:/Temp/CON.txt"
mtime : [1] could not get modification time for file "C:/Temp/CON.txt"
size : [0] 0
stat : [0] mtime 0 atime 0 gid 0 nlink 0 mode 8630 type characterSpecial ctime 0 uid 0 ino 0 size 0 dev -1
type : [0] characterSpecial
The guess that something may be wrong on Windows self (e. g. other return code from WinAPI) has not been confirmed: the same script executed for 8.5th returns the expected results in the last case (exactly as for all 3 first cases). It's not the path and file-name alone, because this weird behavior happens only by the combination temp-path together with "CON.txt". This reflects why the several cmdAH-test-cases fail if used without -tmpdir and successful with -tmpdir parameter.
.\tclsh86 ..\..\tests\all.tcl -file "cmdAH.*" -tmpdir %TEMP%
Total 320 Passed 145 Skipped 175 Failed 0
| |||
User Comments: |
sebres added on 2018-07-16 14:01:13:
fixed in [d61a95dfb6], this close. sebres added on 2018-07-16 13:58:11: Yep that was the reason. But I found the difference - in case of con.txt in temp-folder the NativeStat does open it with CreateFile (but GetFileInformationByHandle fails) and GetFileType returns 2 (FILE_TYPE_CHAR), so ignored in 8.6 (but returns ENOENT in 8.5). So we can ignore it (as weird Windows hack) and I'll repair the test-cases now. apnadkarni added on 2018-07-16 13:13:40: It was two years ago so most likely it would have been either XP or Windows 8 I suspect. I don't think I'd moved to Windows 10 by that time. Also, rethinking the issue I'm wondering whether rather than being pedantic, from a practical point of view it would have been better to have returned 0 as the time instead of raising an error. I still don't feel good about "lying" about the timestamp like that though. Also, I don't think that it is relevant to this specific ticket since you are addressing why the behaviour is *different* in the two cases as opposed to what the specific behaviour is. /Ashok sebres added on 2018-07-16 10:33:05: @Ashok, you've certainly overseen, that all this the test-cases you've made, fail only in if no tmpdir specified (see again the ticket description about the combination where it has different behavior). Neither the test-cases are changed, nor something else (I tested your commit [5e0bded748], it fails likewise if no temp-dir specified.) Which windows-version do you used? apnadkarni added on 2018-07-14 03:35:49: https://core.tcl.tk/tcl/tktview?name=ae61a67192 is the specific ticket. Change was made in July 2016. apnadkarni added on 2018-07-14 03:32:54: From the documentation - " If the file does not exist or its access time cannot be queried or set then an error is generated." For the built-in devices like CON on Windows, access and modification times are not maintained. I had changed the code to raise an error accordingly as logged in some old ticket. However, I am fairly certain all tests passed at the time I made the change (it was a while ago) so either these are new tests or something else has changed. /Ashok bll added on 2018-07-13 22:27:28: Maybe some special case processing for the CON: device that has gone wrong??? |