Menu

#2205 tk_getOpenFile shows symlinks to directories twice

obsolete: 8.4.9
open
5
2007-01-22
2007-01-22
Jeff Epler
No

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.

Discussion

MongoDB Logo MongoDB