Bug #3998 two temporary files created at the root directory of the disk containing the da
Submitted: 4 Jun 2004 10:55 Modified: 11 Aug 2004 11:45
Reporter: Thierry Supplisson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:4.0.20a OS:Windows (Windows XP SP1)
Assigned to: Heikki Tuuri CPU Architecture:Any

[4 Jun 2004 10:55] Thierry Supplisson
Description:
while running mysql succsessfully as a service or standalone, two temporary files are created on
the root directory of the disk containing the data directory (see below the content of my.ini)
the files are named t*** and t***.1 (e.g. e:\t2lk and e:\t2lk.1).

I tried to changed to change/remove the 3 directory locations below without much success.

content of my.ini:

[mysqld]
basedir=c:/mysql
datadir=e:/db/data
tmpdir=e:/db/temp

How to repeat:
- install normally mysql
- run it as a service or standalone

Suggested fix:
None
[4 Jun 2004 19:37] Philip
Try what will happen if you run mysql with a user, which has not rights to write to the root directory
[4 Jun 2004 23:33] MySQL Verification Team
Notice that both files are delete when the server does the
shutdown.
[9 Jun 2004 21:00] Manuel Martin
Hi,

I just found this report.
I have the same behavior here. Additionally, if the account under which the service is running doesn't have the priviledges to write to the drive's root, the service crashes / stops silently (no error in log). This makes the problem a little more critcal, IMO.

OS is Windows 2003.
[16 Jun 2004 18:27] Lee
yep i get this also running Windows XP Pro + SP1 with admin privileges
[19 Jun 2004 9:45] Dean Goddard
Same for Windows 2000 Professional SP 4.
[26 Jun 2004 20:54] Lee
yep i get this with the newest release 4.0.20d for windows.

I'm running Windows XP SP1 and have admin privileges
[28 Jun 2004 19:35] Victor Vagin
Innobase uses tmpfile function twice:

innobase/dict/dict0dict.c:645
innobase/lock/lock0lock.c:511

But MSDN says (ms-help://MS.MSDNQTR.2003APR.1033/vclib/html/_crt_tmpfile.htm):
-------
The tmpfile function creates a temporary file and returns a pointer to that stream. The temporary file is created in the root directory. To create a temporary file in a directory other than the root, use tmpnam or tempnam in conjunction with fopen.
-------

So we'll have to write own implementation for tmpfile..
I'm reassigning the bug to Innobase man..
[6 Aug 2004 15:15] Marko Mäkelä
ChangeSet@1.1946
I've submitted a patch that implements tmpfile() differently in Windows, creating the temporary files in the MySQL data directory. In addition, this patch introduces a start-up parameter for disabling the creation of the <datadir>/innodb_status.<pid> file (it will be created as a temporary file instead).
[11 Aug 2004 11:45] Marko Mäkelä
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

The fix was pushed to the 4.0 tree yesterday and will appear in 4.0.21. InnoDB will use the MySQL function create_temp_file(), which seems to create the files in %TMP% or $TMPDIR in the systems I tested (Windows XP and GNU/Linux).