Bug #2285 mysqlbinlog, possible bug in tmpdir handling
Submitted: 5 Jan 2004 7:56 Modified: 6 Jan 2004 6:43
Reporter: Jani Tolonen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:4.0 OS:Windows (Windows)
Assigned to: Victor Vagin CPU Architecture:Any

[5 Jan 2004 7:56] Jani Tolonen
Description:
When TMP and TEMP environment variables has been set, it is possible
that mysqlbinlog concatenates those with the TMPDIR variable causing
file not found or invalid file name errors on Windows.

The result may look like this for example:

C:\>set tmp
TMP=c:\temp

C:\>set temp
TEMP=c:\temp

mysqlbinlog binlog-file-bin.064

mysqlbinlog: File 'c:\temp\C:/some/other/directory/filename.txt
not found (Errcode: 22)

where C:/some/other/directory/ is MySQL's own tmpdir.

How to repeat:
Have not been able to reproduce this on Linux, have not tried on
Windows.
[6 Jan 2004 4:52] Victor Vagin
I'm afraid I can't repeat this bug for mysql-4.0.16..

actually, I tryed various combination of filenames in log:

/////////////////// file test.bat begins //////////////
set TMP=c:\temp
set TEMP=c:\temp

set TMP
set TEMP

@echo ---------------------------------------
mysqlbinlog.exe eagle-bin.001
@echo ---------------------------------------
mysqlbinlog.exe eagle-bin.001.orig
@echo ---------------------------------------
mysqlbinlog.exe eagle-bin.001.2
@echo ---------------------------------------

/////////////////// file test.bat ends //////////////

but have only received right output:

/////////////////// output starts /////////////////
G:\work\mysql-4.0.16\client_release>set TMP=c:\temp 

G:\work\mysql-4.0.16\client_release>set TEMP=c:\temp 

G:\work\mysql-4.0.16\client_release>set TMP 
TMP=c:\temp

G:\work\mysql-4.0.16\client_release>set TEMP 
TEMP=c:\temp
---------------------------------------

G:\work\mysql-4.0.16\client_release>mysqlbinlog.exe eagle-bin.001 
# at 4
#040107  0:11:05 server id 1  log_pos 4 	Start: binlog v 3, server v 4.0.18-debug-log created 040107  0:11:05 at startup
# at 79
#040107  0:11:05 server id 1  log_pos 79 	Query	thread_id=1	exec_time=0	error_code=0
use test;
SET TIMESTAMP=1073419865;
create table t1 (a int);
# at 137
# LOAD DATA INFILE 'c:\me\vva\work\BUG_2285\tmp\file_for_dump.txt'  IGNORE INTO TABLE t1  FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (a);
# file_id: 1  block_len: 22
# at 266
#040107  0:11:05 server id 1  log_pos 266 
#Exec_load: file_id=1
LOAD DATA LOCAL INFILE 'c:\temp\file_for_dump.txt-1-0'  IGNORE INTO TABLE t1  FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (a);
# file_id: 1  block_len: 22
---------------------------------------

G:\work\mysql-4.0.16\client_release>mysqlbinlog.exe eagle-bin.001.orig 
# at 4
#040107  0:11:05 server id 1  log_pos 4 	Start: binlog v 3, server v 4.0.18-debug-log created 040107  0:11:05 at startup
# at 79
#040107  0:11:05 server id 1  log_pos 79 	Query	thread_id=1	exec_time=0	error_code=0
use test;
SET TIMESTAMP=1073419865;
create table t1 (a int);
# at 137
# LOAD DATA INFILE '/home/vva/work/BUG_2285/tmp/file_for_dump.txt'  IGNORE INTO TABLE t1  FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (a);
# file_id: 1  block_len: 22
# at 266
#040107  0:11:05 server id 1  log_pos 266 
#Exec_load: file_id=1
LOAD DATA LOCAL INFILE 'c:\temp\file_for_dump.txt-1-1'  IGNORE INTO TABLE t1  FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (a);
# file_id: 1  block_len: 22
---------------------------------------

G:\work\mysql-4.0.16\client_release>mysqlbinlog.exe eagle-bin.001.2 
# at 4
#040107  0:11:05 server id 1  log_pos 4 	Start: binlog v 3, server v 4.0.18-debug-log created 040107  0:11:05 at startup
# at 79
#040107  0:11:05 server id 1  log_pos 79 	Query	thread_id=1	exec_time=0	error_code=0
use test;
SET TIMESTAMP=1073419865;
create table t1 (a int);
# at 137
# LOAD DATA INFILE 'c:/me/vva/work/BUG_2285/tmp/file_for_dump.txt'  IGNORE INTO TABLE t1  FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (a);
# file_id: 1  block_len: 22
# at 266
#040107  0:11:05 server id 1  log_pos 266 
#Exec_load: file_id=1
LOAD DATA LOCAL INFILE 'c:\temp\file_for_dump.txt-1-2'  IGNORE INTO TABLE t1  FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (a);
# file_id: 1  block_len: 22
---------------------------------------
/////////////////// output ends /////////////////

Please check what version of mysql do you use..
If it's under 4.0.16 then such an error can present
(was fixed about 2003/09/23) and you have to upgrade 
at least mysqlbinlog..
[6 Jan 2004 6:43] Victor Vagin
I've tested the use case for version 4.0.14 and repeated the bug..

So this bug was verified with 4.0.14 and was fixed in 4.0.16