Dear all,

while looking at bugreport #77 [1], i have revisited the situation 
around tmp file generation in NaviServer.
We have currently the following tcl commands implemented

(a) ns_tmpnam

(b) ns_mktemp

the first one is deprecated since a long time, since it uses the 
deprecated c-library function tmpnam(). I am considering on dropping the 
call to tmpnam() in the code, use instead mktemp(), but keeping the 
command for backward compatibility on the Tcl level. Most compiler 
complain already about the usage of tmpnam().

Concerning (b), the usage of mktemp() is also not really recommended, 
since the creation of the tmp file or directory should be atomic (rather 
than two different  calls for creating a name and the creating then the 
resource). One should use mkstemp()/mkdtemp() instead, which perform the 
tmp-file/dir creating in one step and return the created resource. 
However, the recommended functions are not API-compatible, such we can't 
change simply the implementation in ns_mktemp.

Implementing new commands "ns_mkstemp" or "ns_mkdtemp" in NaviServer 
would not be complex, since we have already a ns_mkstemp() function for 
internal use (also for windows), but i am reluctant introducing new 
commands, since starting with Tcl 8.6, Tcl has a new sub-command  "file 
tempfile" to support temporary file generation. We could/should 
recommend its usage instead.

so i am considering turning ns_tmpnam into a backwards (API) compatible 
proc, and leaving ns_mktemp as it is, hoping that more installations 
will switch to Tcl 8.6 sooner or later. Comments? Opinions? Necessities?

all the best

-gn

[1] https://sourceforge.net/p/naviserver/bugs/77/



------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to