Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Too short a value of TK_MULTI_MAX_PATH

Closed / Fixed641261ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 16 years ago
Descriptionplain2002-11-20 15:09:16
While I disagree with having hard coded limits, I see that 
this is one imposed by the broken design of the Windows 
API. By its very nature a (potentially inappropriate) limit has 
to be used.

However 20*MAX_PATH is too low for a limit, and our 
users have started reporting this as a bug. It is not aided by 
the silent failure whereby no messages are produced, they 
simply see a truncated list.

It is our group that originally added the multiple file access 
to the filebrowser, on both unix and windows. The person 
who made this change (not myself) decided to offload the 
decision of what this hard-coded limit should be to the Tcl 
developer by having the -multiple argument take a size limit 
rather than boolean parameter.

Would it be possible to put such a system back? Whatever 
limit you code you'll be on to a loser - no one value is right 
for everyone - so the logical approach is to make it 
configurable at the script level.
vincentdarleyplain2002-11-20 22:21:48
Logged In: YES 
user_id=32170

This looks to be a Tk bug, not Tcl.  Best to assign it to
whoever maintains that code.

Is there no other Win32 API which isn't so brain-dead?
hobbsplain2002-11-23 09:03:20
Logged In: YES 
user_id=72656

This is a Tk problem, but in any case the assumptions above 
are not correct.  We hardcode that value, but it is out of 
laziness.  If we choose a value that is too small, the dialog 
will return the code FNERR_BUFFERTOOSMALL, allowing 
you to create a larger buffer dynamically.  That way we could 
also start with a smaller stack buffer size.  If you would like to 
make a patch that corrects this, we would be glad to add it.
jkbonfieldplain2002-11-26 22:40:02
Logged In: YES 
user_id=154581

I am not convinced that FNERR_BUFFERTOOSMALL really 
helps as it's too late by then. What do we want the user to 
see? Increasing the buffer size and then retrying implies (I am 
assuming) that the users gets a new filebrowser invoked and 
they have to reselect again. This may happen multiple times 
as we do not know the desired size from the original attempt, 
just that our first guess was too small.

I cannot see an obvious solution unless there is indeed an 
alternative API that doesn't have this design flaw.

Anyway, I'm not a windows developer myself, but I'll discuss 
this with others here and try and get a patch submitted for as 
much as seems possible.
hobbsplain2002-12-01 04:02:55
Logged In: YES 
user_id=72656

OK, I can see that that would possibly be a problem.  My 
suggestion would be to make a modified version of your 
recommended patch - one that specifies the number of 
expected files.  If it is 0, we use just 1*MAX_PATH, and for 
any number less than 20, we leave it at 20*MAX_PATH (for 
backwards compatability with existing functionality), and for 
anything larger it is n*MAX_PATH.  This only makes a 
difference on Windows of course, but it would at least be 
compatible.  There is no reason that we must create that 
buffer on the stack - it can just as well be malloc'ed when we 
know the requested size.
hobbsplain2003-07-19 02:49:12
Logged In: YES 
user_id=72656

I have doubled the size, but the patch for increasing the size 
with a large -multiple value would be better.  Default is not 
*40 (~10K) in 8.4.4 and 8.5a.
hobbsplain2010-08-05 03:38:34
Addressed with patch 2898255 in 8.5.8 and head
hobbsplain2010-08-05 03:38:35
allow_comments - 1
Log in (anonymous is fine) to add a comment.