Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9d918f41
Commit
9d918f41
authored
Feb 26, 2014
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5612 - my_rename() deletes files when it shouldn't
Ported fix for MySQL BUG#51861.
parent
6efa5efa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
+24
-8
mysql-test/suite/csv/csv.result
mysql-test/suite/csv/csv.result
+8
-0
mysql-test/suite/csv/csv.test
mysql-test/suite/csv/csv.test
+9
-0
mysys/my_rename.c
mysys/my_rename.c
+7
-8
No files found.
mysql-test/suite/csv/csv.result
View file @
9d918f41
...
@@ -5485,3 +5485,11 @@ SELECT * FROM t1;
...
@@ -5485,3 +5485,11 @@ SELECT * FROM t1;
ERROR HY000: Table 't1' is marked as crashed and should be repaired
ERROR HY000: Table 't1' is marked as crashed and should be repaired
DROP TABLE t1;
DROP TABLE t1;
End of 5.1 tests
End of 5.1 tests
#
# MDEV-5612 - my_rename() deletes files when it shouldn't
#
CREATE TABLE t1(a INT NOT NULL) ENGINE=CSV;
RENAME TABLE t1 TO t2;
SELECT * FROM t2;
a
DROP TABLE t2;
...
...
mysql-test/suite/csv/csv.test
View file @
9d918f41
...
@@ -1917,3 +1917,12 @@ SELECT * FROM t1;
...
@@ -1917,3 +1917,12 @@ SELECT * FROM t1;
DROP TABLE t1;
DROP TABLE t1;
--echo End of 5.1 tests
--echo End of 5.1 tests
--echo #
--echo # MDEV-5612 - my_rename() deletes files when it shouldn't
--echo #
CREATE TABLE t1(a INT NOT NULL) ENGINE=CSV;
move_file
$MYSQLD_DATADIR
/test/t1.CSV
$MYSQLD_DATADIR
/test/t2.CSV;
RENAME TABLE t1 TO t2;
SELECT * FROM t2;
DROP TABLE t2;
mysys/my_rename.c
View file @
9d918f41
...
@@ -27,19 +27,18 @@ int my_rename(const char *from, const char *to, myf MyFlags)
...
@@ -27,19 +27,18 @@ int my_rename(const char *from, const char *to, myf MyFlags)
DBUG_ENTER
(
"my_rename"
);
DBUG_ENTER
(
"my_rename"
);
DBUG_PRINT
(
"my"
,(
"from %s to %s MyFlags %lu"
,
from
,
to
,
MyFlags
));
DBUG_PRINT
(
"my"
,(
"from %s to %s MyFlags %lu"
,
from
,
to
,
MyFlags
));
#if defined(HAVE_RENAME)
#if defined(__WIN__)
#if defined(__WIN__)
/*
if
(
!
MoveFileEx
(
from
,
to
,
MOVEFILE_COPY_ALLOWED
|
On windows we can't rename over an existing file:
MOVEFILE_REPLACE_EXISTING
))
Remove any conflicting files:
{
*/
my_osmaperr
(
GetLastError
());
(
void
)
my_delete
(
to
,
MYF
(
0
));
#elif defined(HAVE_RENAME)
#endif
if
(
rename
(
from
,
to
))
if
(
rename
(
from
,
to
))
{
#else
#else
if
(
link
(
from
,
to
)
||
unlink
(
from
))
if
(
link
(
from
,
to
)
||
unlink
(
from
))
#endif
{
{
#endif
my_errno
=
errno
;
my_errno
=
errno
;
error
=
-
1
;
error
=
-
1
;
if
(
MyFlags
&
(
MY_FAE
+
MY_WME
))
if
(
MyFlags
&
(
MY_FAE
+
MY_WME
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment