Bug #34224 mysql cli /dev/null overwrite
| Submitted: | 1 Feb 2008 13:16 | Modified: | 18 Jun 2009 15:08 |
|---|---|---|---|
| Reporter: | Akos Torok | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
| Version: | 5.1.22, 5.0.51a | OS: | Linux |
| Assigned to: | Jim Winstead | CPU Architecture: | Any |
[1 Feb 2008 13:16]
Akos Torok
[4 Feb 2008 13:45]
Susanne Ebrecht
Many thanks for writing a bug report. To verify this, we need some more informations from you: 1) do you use readline or libedit? 2) how do you install MySQL? 3) What is the distribution of your Linux? 4) Do you use MySQL as root (mean: system user root)?
[4 Feb 2008 16:01]
Akos Torok
1) readline 2) from source, or from the distribution 3) debian, gentoo, ubuntu 4) yes
[3 Apr 2008 5:51]
Sveta Smirnova
Thank you for the report. Verified as described.
[3 Apr 2008 16:11]
MySQL Verification Team
This is not a bug. If you do not want to have history file, you can export MYSQL_HISTFILE as empty string.
[4 Apr 2008 11:46]
Akos Torok
From the manual page of the mysql cli(5.1.23rc):
If you do not want to maintain a history file, first remove
.mysql_history if it exists, and then use either of the following
techniques:
o Set the MYSQL_HISTFILE variable to /dev/null. To cause this setting
to take effect each time you log in, put the setting in one of your
shell's startup files.
o Create .mysql_history as a symbolic link to /dev/null:
shell> ln -s /dev/null $HOME/.mysql_history
[4 Apr 2008 16:55]
Sveta Smirnova
Thank you for the feedback. Reclassified as documentation request. Correct procedure: MYSQL_HISTFILE="" Also manual should contain alert about it is not safe to use /dev/null when login as root.
[1 Jun 2008 6:00]
Sveta Smirnova
Set back to "Client", because workaround export MYSQL_HISTFILE='' doesn't work in versions >=5.0
[1 Jun 2008 6:03]
Sveta Smirnova
Current behavior: $export MYSQL_HISTFILE='' $mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2427 Server version: 5.0.51a-log MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select 1; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.01 sec) mysql> \q /Users/apple/Applications/mysql-5.1/bin/mysql: Error on rename of '.TMP' to '' (Errcode: 2) Bye
[1 Jun 2008 13:09]
Akos Torok
The same problem on Mac OS X 10.5.3, with mysql version 5.0.51b.
You can use the `unset MYSQL_HISTFILE` command to avoid this problem.
I think the problem is in client/mysql.cc, line 487:
sprintf(histfile_tmp, "%s.TMP", histfile);
and in the line 538:
if (!write_history(histfile_tmp))
my_rename(histfile_tmp, histfile, MYF(MY_WME));
}
If you start the cli with -v, you can see the problem.
[10 Dec 2008 11:31]
Alessandro Giannini
Check MYSQL_HISTFILE
Attachment: mysql.cc (text/plain), 134.74 KiB.
[10 Dec 2008 11:39]
Alessandro Giannini
Sorry I forgot to insert a comment to my last upload. This BUG is present also in 5.1.30 release. In my version I declared histfile and histfile_tm variables to NULL and I checked ( trimming ) the MYSQL_HISTFILE content. When MYSQL_HISTFILE is equal to "" no history files will be writter. I think this behavior is very useful ! :)
[8 May 2009 0:49]
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/73626 2891 Jim Winstead 2009-05-07 The mysql command-line client did not properly handle MYSQL_HISTFILE being set to an empty string, or to /dev/null, as we suggest and have suggested in the documentation. (Bug #34224) modified: client/mysql.cc
[13 May 2009 16:07]
Jim Winstead
Patch queued to 5.1-bugteam, will be merged up from there.
[28 May 2009 8:18]
Bugs System
Pushed into 5.1.36 (revid:joro@sun.com-20090528073639-yohsb4q1jzg7ycws) (version source revid:jimw@mysql.com-20090512212719-mjc8fz4q3ewvr4yd) (merge vers: 5.1.35) (pib:6)
[30 May 2009 2:27]
Paul DuBois
Noted in 5.1.36 changelog. If the MYSQL_HISTFILE environment variable was set to /dev/null, the mysql client overwrote the /dev/null device file as a normal file. Setting report to NDI pending push into 6.0.x.
[17 Jun 2009 19:25]
Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:jimw@mysql.com-20090514020104-7u5cqf5cyywa8aks) (merge vers: 6.0.12-alpha) (pib:11)
[18 Jun 2009 15:08]
Paul DuBois
Noted in 5.4.4 changelog.
[26 Aug 2009 13:46]
Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46]
Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48]
Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:33]
Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[8 Oct 2009 20:35]
Paul DuBois
The 5.4 fix has been pushed to 5.4.2.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.