Bug #4737 Drop database db_name fails
Submitted: 24 Jul 2004 13:10 Modified: 29 Jul 2004 23:42
Reporter: Miguel Solorzano Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.4 BK source tree OS:Microsoft Windows (Windows)
Assigned to: MySQL Verification Team CPU Architecture:Any

[24 Jul 2004 13:10] Miguel Solorzano
Description:
The drop database db_name fails as showed below:

C:\mysql\bin>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.4-beta-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database if not exists appfuse;
Query OK, 1 row affected (0.06 sec)

mysql> drop database appfuse;
ERROR 1010 (HY000): Error dropping database (can't rmdir '.\appfuse', errno: 41)

How to repeat:
see description

Suggested fix:
Revert or modify the changeset which introduced the below lines of code in
/mysys/my_lib.c:

    /*
      If the directory is the root directory of the drive, Windows sometimes
      creates hidden or system files there (like RECYCLER); do not show
      them. We would need to see how this can be achieved with a Borland
      compiler.
    */
#ifndef __BORLANDC__
    if (attrib & (_A_HIDDEN | _A_SYSTEM))
      continue;
#endif

Removing the above lines of code:

C:\mysql\bin>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.4-beta-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database if not exists appfuse;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+----------+
| Database |
+----------+
| appfuse  |
| mysql    |
| test     |
| test2    |
| world    |
+----------+
5 rows in set (0.00 sec)

mysql> drop database appfuse;
Query OK, 0 rows affected (0.05 sec)

mysql> show databases;
+----------+
| Database |
+----------+
| mysql    |
| test     |
| test2    |
| world    |
+----------+
4 rows in set (0.00 sec)

In the debugger you can see the below variables values:

mysql_real_data_home	0x008f2230 "C:\mysql\data\"

mysql_data_home	0x008f3614 "."

path	0x0558f088 ".\appfuse\"

Then the path value most probably was compound with mysql_data_home
which is the hidden character and ".\appfuse\" is sent to my_dir(...).
[29 Jul 2004 23:42] MySQL Verification Team
Reverted patch for bug #4375 and this last one re-opened.
[18 Oct 2005 14:54] 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/internals/31218