Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-05
08:20 • Ticket [219012ffff] tmpnam limitation status still Closed with 3 other chang... artifact: 616cd0e14f user: dgp
2000-10-26
08:33 • Closed ticket [219012ffff]. artifact: 13829f4e42 user: welch
01:09 • New ticket [219012ffff]. artifact: 32d512be5b user: nobody

tmpnam limitation

Closed / Fixed219012ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:09:18
OriginalBugID: 3911 Bug
Version: 8.2
SubmitDate: '1999-12-21'
LastModified: '2000-03-31'
Severity: SER
Status: Released
Submitter: techsupp
ChangedBy: ericm
OS: Linux
Machine: IBM PC/AT compatible
FixedDate: '2000-03-31'
FixedInVersion: 8.3.1
ClosedDate: '2000-10-25'


Name:
Hiroshi Kasai

CustomShell:
JP patch

Comments:
Precisely, I found this bug in tcl7.6. But, it is same as in tcl8.2.

If you use a function 'exec' or 'open "|..."', tcl calls a function 'tmpnam'. This function has a limitation.
It is defined in stdio.h as
#define TMP_MAX 238328
This is a maximum number of calls for the function 'tmpnam'.
If it gets over, the function returns NULL. But, the function is used as

char fileName[L_tmpnam]; 

tmpnam(fileName); 

The 'fileName' is local variable. So, if 'tmpnam' returned NULL, 'fileName' value is not changed.
And more, the variable is not initialized because it is local,
Nothing happens if it is lucky.An error is indicated if it has bad luck a little.
When it is the worst, if the variable has a exist file name, the file is destroyed.
It is to redirect standard error output specifically to avoid this.

ReproducibleScript:
open "|command"
exec command

ObservedBehavior:
couldn't create error file : no such file or directory



Thanks for pointing this out.  I added a test for a NULL return from tmpnam, which will solve this problem on Linux and should be non-harmful on other UNIX (Solaris and HP-UX both follow a different convention when TMP_MAX is exceeded).  This fix will go out with 8.3.1.

- eric

-- 03/31/2000 ericm
welch Closed ticket [219012ffff]. [History diff]2000-10-26 08:33:09
dgp Ticket [219012ffff]: 3 changes [History diff]2001-04-05 08:20:12
Log in (anonymous is fine) to add a comment.