Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-11-30
01:24 • Closed ticket [999162ffff]: TIP#210: Add tempname subcommand to file plus 7 ... artifact: 82308c51b0 user: dkf
2008-11-22
00:19 • Ticket [999162ffff]: 4 changes artifact: 3aa6db4f3f user: matzek
2008-11-20
17:29 • Ticket [999162ffff]: 4 changes artifact: e79f3a23ae user: dkf
2004-10-28
19:39 • Ticket [999162ffff]: 1 change artifact: 9b90982cbc user: dkf
2004-08-04
17:05 • Ticket [999162ffff]: 1 change artifact: 1852ed8bef user: dkf
2004-07-28
12:14 • Ticket [999162ffff]: 1 change artifact: cc02bfaff2 user: techentin
12:13 • Ticket [999162ffff]: 4 changes artifact: 948b0b2d38 user: techentin
12:13 • Add attachment file-tempname.patch to ticket [999162ffffffffff|999162ff... artifact: c23012c7b6 user: techentin
05:13 • New ticket [999162ffff] Add file tempname. artifact: 0f601fec48 user: techentin

TIP#210: Add tempname subcommand to file

Closed / Fixed999162ffffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 18 years ago
Descriptionplain2004-07-28 05:13:25
This patch adds a new tempname subcommand to the file command.

The patch changes generic/tclCmdAH.c and generic/tclFCmd.c, adding a new command and function, which essentially calls the ANSI function tmpnam().

Changes to the file.n man page and test suite are included.

The Linux Programmer's Manual (Linux man pages) isn't very flattering towards tmpnam().  It basically says to use mkstemp() instead, but that function is POSIX instead of ANSI C.
techentinplain2004-07-28 12:13:26
File Added - 95502: file-tempname.patch
techentin Ticket [999162ffff]: 1 change [History diff]2004-07-28 12:14:54
dkf Ticket [999162ffff]: 1 change [History diff]2004-08-04 17:05:59
dkf Ticket [999162ffff]: 1 change [History diff]2004-10-28 19:39:48
dkfplain2008-11-20 17:29:46
Need to update to use mkstemp() or something like that.
matzekplain2008-11-22 00:19:31
I think there is no need to go into C level. Have a look at tcllibs ::fileutil::tempfile for Tcl only implementation that's fine with regard to race conditions and security.

Please stay away from tmpnam() and friends. Consider:
* http://cwe.mitre.org/data/definitions/377.html
* https://buildsecurityin.us-cert.gov/daisy/bsi-rules/home/g1/861-BSI.html

mkstemp() is the only way to go at C-Level...

kind regards -- Matthias Kraft
dkfplain2008-11-30 01:24:22
Implemented.

At C level, we're using mkstemps() or mkstemp() on Unix, and something fairly horrible on Win (which still has the right security properties).
Log in (anonymous is fine) to add a comment.

Attachments: