Artifacts Associated With Ticket 3608360
Ticket change [c52d2e6c92] (rid 111953) by schmitzu on 2013-03-18 08:28:19:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
There is an incompatibilty concerning "file exists" in 8.6: % puts $tcl_patchLevel 8.6.0 % glob * x.tcl % file exists *.tcl 1 Whereas in 8.5: % puts $tcl_patchLevel 8.5.12 % glob * x.tcl % file exists *.tcl 0 platform: Win7_x64, tcl-binaries: ActiveState. This breaks backward compatibility.
- foundin initialized to: "current: 8.6.0"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "schmitzu"
- subsystem initialized to: "16. Commands A-H"
- title initialized to: "Incompatible behaviour of "file exists""
- type initialized to: "Bug"
Ticket change [ecdf3d23e5] (rid 103781) by dkf on 2013-03-18 16:59:07:
- assignee changed to: "nijtmans"
- icomment:
Definitely a problem in implementation of NativeAccess() in tclWinFile.c (the generic layers over that do the right thing) but I really don't know the relevant API. Is this related to 2893771? (Committed on 2009-11-24 in https://core.tcl.tk/tcl/info/02224b9ef68c so it fits with being an 8.6.* issue.) We're feeding a filename into FindFirstFile which is the directory entry enumerator, which in turn is the only thing that can do that sort of thing with a glob patter AIUI. My knowledge of the deep ins-and-outs of Win32 is too small for me to go further. Assigning to someone who knows more about the relevant bits than me. Perhaps just testing for glob metacharacters in the name would be enough? I vaguely remember them as being always forbidden in filenames...
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "8"
- username: "dkf"
Ticket change [71ae5cc672] (rid 100730) by nijtmans on 2013-03-18 17:55:09:
- icomment:
I will have a look. Thanks!
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [8c5284e08a] (rid 127725) by nijtmans on 2013-03-18 20:03:27:
- closedate changed to: "2013-03-18T13:03:27"
- closer changed to: "nijtmans"
- icomment:
On UNIX (actually Cygwin): $ tclsh8.5 % puts $tcl_patchLevel 8.5.13 % glob *.tcl x.tcl % file exists *.tcl 0 $ tclsh8.6 % puts $tcl_patchLevel 8.6.0 % glob *.tcl x.tcl % file exists *.tcl 0 % exit Conclusion: the fact that using the '*' character this way in [file exists] worked at all in win32 was an undocumented feature and is non-portable. On UNIX, the '*' character can be used in filenames like any other character, only it must be escaped if the filename goes through a shell.
- login: "nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Pending"
- username: "nijtmans"
Ticket change [97424aa77b] (rid 106473) by nijtmans on 2013-03-18 20:03:45:
- closedate changed to: "2013-03-18T13:03:45"
- closer changed to: "nijtmans"
- status changed to: "Closed"
Ticket change [234ba44deb] (rid 130899) by nijtmans on 2013-03-18 20:13:17:
- foundin changed to: "obsolete: 8.5.13"
- icomment:
Apparently, the fix is already backported to 8.4 and 8.5 as well: ====================================== >tclsh84 % puts $tcl_patchLevel 8.4.19 % glob *.tcl x.tcl % file exists *.tcl 0 % exit >tclsh85 % puts $tcl_patchLevel 8.5.13 % glob *.tcl x.tcl % file exists *.tcl 0 % exit
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
Ticket change [0cfb7af501] (rid 114279) by dkf on 2013-03-18 20:44:46:
- foundin changed to: "current: 8.6.0"
- icomment:
I think you're misreading. This is (supposedly) a regression in 8.6 whereby, if 'x.tcl' exists in the current directory (but '*.tcl' does not), [file exists *.tcl] returns 1. If there's a problem, it exists in that NativeAccess function. (I cannot confirm or deny; I don't have the right platform. I also don't know if the Cygwin build uses the same code; if not, it doesn't count.) I suspect that if there is a problem, it is inside there and related to the use of an API that does expansion. FindFirstFile is such a function, and it is definitely used in the NativeAccess code; the commit I indicated appears to be the one that introduced it. FindFirstFile is documented here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx Moreover, I've confirmed that * is an illegal character in a filename on Windows. Search for "reserved characters" in http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx At the very least, we could have a test for this! In fact, I'll write one. [file exists] definitely shouldn't ever do wildcard expansion behind the scenes on any platform.
- login: "dkf"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "dkf"
Ticket change [3a46b75e97] (rid 112538) by nijtmans on 2013-03-18 21:03:13:
- icomment:
> I think you're misreading. This is (supposedly) a regression in 8.6 > whereby, if 'x.tcl' exists in the current directory (but '*.tcl' does not), > [file exists *.tcl] returns 1. If it's a regression, then it's a regression in 8.5.13 as well, because I cannot reproduce it any more. But I think we fully agree. > At the very least, we could have a test for this! In fact, I'll write one. > [file exists] definitely shouldn't ever do wildcard expansion behind the > scenes on any platform. I fully agree with that: [file exists] shouldn't do wildcard expansion on any platform! That means: this change was not a regression, it was a bug-fix. I welcome your testcase!
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [e6aad0460d] (rid 104330) by nijtmans on 2013-03-18 21:39:18:
- closedate changed to: "2013-03-18T14:39:18"
- closer changed to: "nijtmans"
- icomment:
allow_comments - 1 Thanks, Donal, for your test-case! I tried it on win32 too, and it works fine. Closing now.
- login: "nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "nijtmans"
Ticket change [cb7dbf23f2] (rid 95531) by nijtmans on 2013-03-18 21:39:29:
- icomment:
allow_comments - 0
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [877e038cf2] (rid 131704) by dkf on 2013-03-18 21:40:44:
- icomment:
Test committed. If that fails on Windows with a non-Cygwin build, we know there's a serious problem. (I suspect this is all caused by the fact that you can't do an access()-equivalent check on a file easily without running into problems with locking. Which seems supremely stupid.)
- login: "dkf"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "dkf"
- icomment:
Ticket change [66a6400494] (rid 102749) by dkf on 2013-03-18 21:42:23:
- closedate changed to: "2013-03-18T14:42:23"
- closer changed to: "dkf"
- status changed to: "Pending"
Ticket change [068d1b1c37] (rid 89244) by dkf on 2013-03-19 18:00:55:
- icomment:
Uwe reports on comp.lang.tcl in message <[email protected]> that: here my result with cmdAH.test from trunk (ActiveState tcl8.6 binaries under win7_x64 as before): >tclsh cmdAH.test ==== cmdAH-19.12 Bug 3608360: [file exists] mustn't do globbing FAILED ==== Contents of test case: list [file exists foo.bar] [file exists *.bar] ---- Result was: 1 1 ---- Result should have been (exact matching): 1 0 ==== cmdAH-19.12 FAILED cmdAH.test: Total 308 Passed 132 Skipped 175 Failed 1 Number of tests skipped for each constraint: 4 nonPortable 1 tempNotWin 3 testchmod 146 testsetplatform 1 testvolumetype 20 unix ----- Summary: it's a real bug in that configuration.
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "None"
- status changed to: "Open"
- username: "dkf"
- icomment:
Ticket change [4ac98bad95] (rid 126586) by dkf on 2013-03-19 18:50:18:
- icomment:
See bug-3608360 for a possible fix. (Warning: untested!)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [707799535f] (rid 100486) by nijtmans on 2013-03-19 21:24:15:
- closedate changed to: "2013-03-19T14:24:15"
- closer changed to: "nijtmans"
- icomment:
allow_comments - 1 Fixed now in all branches.
- login: "nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "nijtmans"
Ticket change [eca9f6cbc9] (rid 103746) by nijtmans on 2013-03-19 21:25:47:
- icomment:
>Fixed now in all branches. I mean on trunk, of course. core-8-5-branch and earlier never had the bug.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment: