Tk Source Code

View Ticket
Login
Ticket UUID: 1641721
Title: tk_getOpenFile shows symlinks to directories twice
Type: Bug Version: 8.6.4
Submitter: jepler Created on: 2007-01-22 15:27:07
Subsystem: 37. [tk_get*File] Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2015-05-26 12:45:46
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2015-05-26 12:45:46
Description:
Create a directory with a symlink to a directory:
$ mkdir zot
$ cd zot
$ ln -s / x

Run tk_getOpenFile on that location:
$ wish
% tk_getOpenFile

"x" appears twice, once as a directory and once as a file.

This bug has been observed in: tk8.4-8.4.9-1build1 (Ubuntu 5.10)
This bug was not present in: tk-8.3.5 (RedHat 9)

From inspection of the source, I believe the problem is still present in the CVS versions of tk8.4 and tk8.5, but I have not tested those versions.

I think the problem is around http://tktoolkit.cvs.sourceforge.net/tktoolkit/tk/library/tkfbox.tcl?revision=1.58&view=markup#l_1300
because a symlink to a directory will match both [glob -type d] and [glob -type l]:
$ tclsh
% glob -type d *
x
% glob -type l *
x

Removing l from the list of glob types would fix this problem, and would also remove dangling symlinks which give an error when selected anyway.
User Comments: jan.nijtmans added on 2015-05-26 12:45:46:
Fix committed to both core-8-5-branch and trunk

jan.nijtmans added on 2015-05-26 11:42:02:
I still can reproduce this easily, so I'll have a look

anonymous added on 2015-05-25 04:50:13:
This appears to have been fixed indirectly in check-in [89300ed4].