Bug #28774 mysql_upgrade creates tempfiles in root-dir (C:\) and doesn't clean them up
Submitted: 30 May 2007 12:06 Modified: 1 Nov 2007 2:36
Reporter: Armin Schöffmann (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.42-enterprise OS:Windows (XP, Vista)
Assigned to: Iggy Galarza CPU Architecture:Any
Tags: Contribution, mysql_upgrade, temp-file, vista, windows, XP

[30 May 2007 12:06] Armin Schöffmann
Description:
Invoking mysql_upgrade creates 3 temp-files in C:\ which are not cleaned up after termination.

Exspected behaviour:
Temp-files are to be created in either the system-temp-directory or mysql's temp-directory.

Temp-files shall be deleted upon process-termination.

The problem was reproduced on Windows XP SP2, Windows Vista X64 SP0.

With Windows 2000SP4, we have a different behaviour:
mysql_upgrade stops with error-message, the temp-files are not created:
[...]
Running 'mysql_fix_privilege_tables'...
FATAL ERROR: Failed to create temporary file for defaults

This seems to be reported as bug #28606
http://bugs.mysql.com/bug.php?id=28606

Regards,
Armin.

 

How to repeat:
C:\Program Files (x86)\MySQL 5.0\bin>dir c:\*.tmp
 Volume in Laufwerk C: hat keine Bezeichnung.
 Volumeseriennummer: 2881-9D78

 Verzeichnis von c:\

Datei nicht gefunden

C:\Program Files (x86)\MySQL 5.0\bin>mysql_upgrade  --force
Looking for 'mysql.exe' in: C:\Program Files (x86)\MySQL 5.0\bin\mysql.exe
Looking for 'mysqlcheck.exe' in: C:\Program Files (x86)\MySQL 5.0\bin\mysqlcheck.exe
Running 'mysqlcheck'...
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
mysql.user_info                                    OK
alfredo.chucks                                     OK
alfredo.production                                 OK
alfredo.recipes                                    OK
alfredo.scan_data                                  OK
alfredo.users                                      OK
Running 'mysql_fix_privilege_tables'...
OK

C:\Program Files (x86)\MySQL 5.0\bin>dir c:\*.tmp
 Volume in Laufwerk C: hat keine Bezeichnung.
 Volumeseriennummer: 2881-9D78

 Verzeichnis von c:\

30.05.2007  13:49            31.867 sql11F2.tmp
30.05.2007  13:49                29 sql152F.tmp
30.05.2007  13:49                29 sql158E.tmp
               3 Datei(en),         31.925 Bytes
               0 Verzeichnis(se), 38.488.231.936 Bytes frei

C:\Program Files (x86)\MySQL 5.0\bin>set
[...]
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\asc\AppData\Local\Temp
TMP=C:\Users\asc\AppData\Local\Temp
USERDOMAIN=aegaeon-64
USERNAME=asc
USERPROFILE=C:\Users\asc
VS80COMNTOOLS=C:\Program Files (x86)\MSVS\Studio 8\Common7\Tools\
windir=C:\Windows
WTTBIN=C:\Program Files\Microsoft Driver Test Manager\Controller\
[30 May 2007 20:24] MySQL Verification Team
Thank you for the bug report. I was able to repeat the below reported
behavior on Vista and with latest Windows source server 5.0.44:

c:\build\5.0>bin\mysql_upgrade --force
Looking for 'mysql.exe' in: c:\build\5.0\bin\mysql.exe
Looking for 'mysqlcheck.exe' in: c:\build\5.0\bin\mysqlcheck.exe
Running 'mysqlcheck'...
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Running 'mysql_fix_privilege_tables'...
FATAL ERROR: Failed to create temporary file for defaults

I will ask to co-worker to verify too.
[5 Jun 2007 15:07] Armin Schöffmann
diff-patch: create-temp-files in def. temp-dir

Attachment: mf_tempfile.c.patch.txt (text/plain), 840 bytes.

[5 Jun 2007 15:08] Armin Schöffmann
diff-patch:cleanup temp-files created during mysql_upgrade

Attachment: mysql_upgrade.c.patch.txt (text/plain), 998 bytes.

[29 Jun 2007 14:58] Iggy Galarza
Marked bug#28606 a duplicate of this one.
[9 Oct 2007 2:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35163

ChangeSet@1.2527, 2007-10-08 22:30:41-04:00, iggy@alf.(none) +1 -0
  Bug#28774 mysql_upgrade creates tempfiles in root-dir (C:\) and 
  doesn't clean them up
  - Make sure to cleanup temporary files after use.
[18 Oct 2007 21:35] Bugs System
Pushed into 5.1.23-beta
[18 Oct 2007 21:37] Bugs System
Pushed into 5.0.52
[1 Nov 2007 2:36] Paul DuBois
Noted in 5.0.52, 5.1.23 changelogs.
[1 Dec 2008 22:17] Anders Hovmöller
I am getting the "FATAL ERROR: Failed to create temporary file for defaults" error on windows with 5.1.30, so it seems something is still wrong here. It would help if the program could give me the reason it fails to create the temp file.
[5 Dec 2008 9:42] Magnus Blåudd
Anders, please file a new bug. This one has been Closed.
[10 Dec 2008 20:15] Sveta Smirnova
Anders, Magnus, 

there is such bug report: bug #41057