Artifacts Associated With Ticket 2806250fffffffffffffffffffffffffffffffff
Ticket change [161b58bdd8] (rid 124669) by juliannoble on 2009-06-14 16:57:33:
- assignee initialized to: "vincentdarley"
- cmimetype initialized to: "text/plain"
- comment initialized to:
When a filename contains a tilde character 'file exists' may falsely return zero. The bug occurs when the filename as returned from glob is used. Any call to 'file normalize' - even without using the returned value will cause a subsequent 'file exists' to correctly return 1. When the path is entered directly in tclsh, or hardcoded into a script, file exists correctly returns 1. set folder {/usr/local/test/} set files [glob -dir $folder -type f *] foreach f $files { #puts [file normalize $f] puts "$f exists: [file exists $f]" } Simply create a text file with the name "~test.txt" in the test folder. With the 1st puts commented, the output is: /usr/local/test/~test.txt exists: 0 With the puts uncommented, the output is: /usr/local/test/~test.txt /usr/local/test/~test.txt exists: 1 Tested on FreeBSD 8.6b1.1 2009-06-14 checkout. - foundin initialized to: "obsolete: 8.6b1.1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "juliannoble"
- subsystem initialized to: "37. File System"
- title initialized to:
glob, 'file exists', 'file normalize' interaction with tilde
- type initialized to: "Bug"
Ticket change [b4e61565c3] (rid 125130) by juliannoble on 2009-06-15 22:17:57:
- icomment:
Verified that bug occurs on windows vista x64 with Tcl 8.6b1.1 Does not occur with an 8.5.2 tclkitsh on that platform. The bug appears to also relate in some way to the current working directory. If there is another copy of the file ~test.txt within whatever directory [pwd] refers to - then [info exists] returns 1. The tilde seems to somehow cause the path to refer to the working directory instead of the one being globbed upon. (so for example - if the original script is placed in the same folder as the one with the test file and run from there - the bug is not apparent)
- login: "juliannoble"
- mimetype: "text/plain"
- username: "juliannoble"
- icomment:
Ticket change [d8b3814dc3] (rid 107489) by dgp on 2009-06-16 01:20:06:
- icomment:
Can't reproduce on Linux with the tip of any active branch.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [012b8cb7b9] (rid 119431) by dgp on 2009-06-16 01:21:47:
- assignee changed to: "dgp"
Ticket change [fb67b2ffdb] (rid 92061) by dgp on 2009-06-16 01:42:19:
- closedate changed to: "2009-06-15T18:42:19"
- closer changed to: "dgp"
- icomment:
Perhaps some detail is not getting reported, and what's really happening is some symptom of Bug 2511011?
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Works For Me"
- status changed to: "Pending"
- username: "dgp"
Ticket change [f33f44f827] (rid 129676) by juliannoble on 2009-06-17 00:47:38:
- icomment:
Verified that it does occur on Linux (CentOS) with 8.6b1.1 (but does not occur with 8.5.7 tclkit) uname -a Linux project-open-v33 2.6.18-53.1.21.el4 #1 SMP Tue May 20 09:34:19 EDT 2008 i686 i686 i386 GNU/Linux This is the 3rd platform I've duplicated the bug on. I'll explain it a bit more step by step - as I've found a couple of ways the bug can be hidden. -------------------------------- create a folder structure /tmp/working/examine Make sure the examine folder contains only the ~test.txt file Save the following script as filenames.tcl - into the /tmp/working folder set folder {/tmp/working/examine} set files [glob -dir $folder -type f *] foreach f $files { #puts [file normalize $f] puts "$f exists: [file exists $f]" } Make sure you run the script from within /tmp/working As mentioned in my other comment - if you run the script whilst your pwd is /tmp/working/examine - the bug will be masked. > cd /tmp/working/filenames.tcl > tclsh filenames.tcl /tmp/working/examine/~test.txt exists: 0 ---------------------------------------------------------- Note that if you run it with the full path name to the script - you won't see the zero in the output. ie it must be called as 'tclsh filenames.tcl' not 'tclsh /tmp/working/filenames.tcl' Another weird thing is that if you add the following line to the top of filenames.tcl - then suddenly the bug *does* appear when called as 'tclsh /tmp/working/filenames.tcl' puts stdout "pwd: [pwd]" It seems to me that it's possibly somewhat different to bug 2511011 because in this case we are supplying the -dir argument to glob and not using -tail, so we are always dealing with the complete path. As far as I can see - there should be no tilde/homedir substitution involved in this case. - login: "juliannoble"
- mimetype: "text/plain"
- resolution changed to: "None"
- status changed to: "Open"
- username: "juliannoble"
- icomment:
Ticket change [a4806bd8bb] (rid 110217) by juliannoble on 2009-06-17 01:30:22:
- icomment:
> cd /tmp/working/filenames.tcl should read: >cd /tmp/working
- login: "juliannoble"
- mimetype: "text/plain"
- username: "juliannoble"
- icomment:
Ticket change [fd1a74e736] (rid 108353) by juliannoble on 2009-08-09 19:12:22:
- icomment:
priority raised. This issue has come up again on CLT. http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/2c8027298fe860f3/28cb705e1fb0e74d#28cb705e1fb0e74d
- login: "juliannoble"
- mimetype: "text/plain"
- priority changed to: "8"
- username: "juliannoble"
- icomment:
Ticket change [8aafff0143] (rid 127432) by juliannoble on 2009-08-10 06:50:06:
- icomment:
Title updated to remove reference to 'file normalize'. It seems that various other operations on the string (e.g subst) can be used to coax a bad path representation to do the correct thing. e.g set f [string range $f 0 end]
- login: "juliannoble"
- mimetype: "text/plain"
- username: "juliannoble"
- icomment:
Ticket change [31697cfefc] (rid 93424) by juliannoble on 2009-08-10 06:50:07:
- title changed to: "glob, tilde string representation anomaly"
Ticket change [2140700d93] (rid 130551) by dkf on 2009-08-10 07:26:07:
- icomment:
Sounds like a problem internal rep.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [970a9a65c4] (rid 106438) by dgp on 2009-08-19 00:42:51:
- icomment:
committed test fileName-20.7 to all branches to test for this bug.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [0b3c6def0b] (rid 113949) by dgp on 2009-08-20 00:25:32:
- icomment:
The PATHFLAGS != 0 internal rep for path values stores the path in two parts, a "head" and a "tail". Much of the code that operates on this rep makes the assumption that the "tail" is a relative path. When a value starting with ~ is permitted to get stored as the tail, these assumptions no longer hold.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [17dc50c4e6] (rid 122567) by dgp on 2009-08-20 04:49:20:
- icomment:
File Added - 339822: 2806250.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "2806250.patch" [21d9a82b9a] (rid 130654) by dgp on 2009-08-20 04:49:20.
Ticket change [fc33cb932f] (rid 108189) by dgp on 2009-08-20 04:49:46:
- icomment:
Attached a patch for 8.5
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "2806250-2.patch" [265ee3f77b] (rid 88332) by dgp on 2009-08-20 21:50:43.
Ticket change [8c324b21b4] (rid 127709) by dgp on 2009-08-20 21:50:43:
- icomment:
File Added - 339935: 2806250-2.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [33b92a45ef] (rid 106642) by dgp on 2009-08-20 21:52:32:
- icomment:
Version 2 of the patch also removes some special workaround code in TclMakePathRelative() that prevented it from doing the wrong thing when the "tail" held a string starting with ~. Since we no longer permit that, we do not need the workaround. Large comments questioning the rationale of some bits of code, and pondering about their reform also in the new patch.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [26714fc932] (rid 88348) by dgp on 2009-08-20 22:00:38:
- icomment:
fix committed for 8.5.8. Should see the tests fileName-20.7,8 now pass.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [510517fdde] (rid 126064) by dgp on 2009-08-20 22:18:44:
- closedate changed to: "2009-08-20T15:18:44"
- closer changed to: "dgp"
- icomment:
allow_comments - 1 Committed more radical patch to HEAD for 8.6b2 that also removes some large chunks of code complexity which had no obvious value.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"
Ticket change [38f72b1631] (rid 112307) by dgp on 2009-10-28 04:00:59:
- icomment:
Reports on the chat indicate that tests fileName-20.7,8 are failing on Windows. Re-opened.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [bf15e7239f] (rid 102195) by dgp on 2009-10-28 04:01:00:
- icomment:
allow_comments - 0
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- status changed to: "Open"
- username: "dgp"
- icomment:
Ticket change [ebe073f0d1] (rid 103611) by dgp on 2009-10-28 23:22:34:
- icomment:
tests are broken, kbk has the fix.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [ef435be004] (rid 108964) by dgp on 2009-10-28 23:22:35:
- assignee changed to: "kennykb"
Ticket change [9e21f81e8c] (rid 96426) by kennykb on 2009-10-28 23:51:34:
- icomment:
Fix committed - was poor test hygiene in managing the working directory.
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
- icomment:
Ticket change [4cb68eba66] (rid 126936) by kennykb on 2009-10-28 23:51:36:
- closedate changed to: "2009-10-28T16:51:36"
- closer changed to: "kennykb"
- icomment:
allow_comments - 1
- login: "kennykb"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "kennykb"