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
444bbe56
Commit
444bbe56
authored
May 27, 2009
by
Bjorn Munch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cherry picking fix for Bug #39542 from 6.0-runtime
parent
f7a645c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
1 deletion
+92
-1
client/mysqltest.cc
client/mysqltest.cc
+40
-1
mysql-test/r/mysqltest.result
mysql-test/r/mysqltest.result
+2
-0
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+50
-0
No files found.
client/mysqltest.cc
View file @
444bbe56
...
...
@@ -280,6 +280,7 @@ enum enum_commands {
Q_SEND_QUIT
,
Q_CHANGE_USER
,
Q_MKDIR
,
Q_RMDIR
,
Q_LIST_FILES
,
Q_LIST_FILES_WRITE_FILE
,
Q_LIST_FILES_APPEND_FILE
,
Q_SEND_SHUTDOWN
,
Q_SHUTDOWN_SERVER
,
Q_MOVE_FILE
,
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
...
...
@@ -376,6 +377,7 @@ const char *command_names[]=
"list_files_append_file"
,
"send_shutdown"
,
"shutdown_server"
,
"move_file"
,
0
};
...
...
@@ -1807,7 +1809,7 @@ void check_result()
log_file
.
file_name
(),
reject_file
,
errno
);
show_diff
(
NULL
,
result_file_name
,
reject_file
);
die
(
mess
);
die
(
"%s"
,
mess
);
break
;
}
default:
/* impossible */
...
...
@@ -2902,6 +2904,42 @@ void do_copy_file(struct st_command *command)
}
/*
SYNOPSIS
do_move_file
command command handle
DESCRIPTION
move_file <from_file> <to_file>
Move <from_file> to <to_file>
*/
void
do_move_file
(
struct
st_command
*
command
)
{
int
error
;
static
DYNAMIC_STRING
ds_from_file
;
static
DYNAMIC_STRING
ds_to_file
;
const
struct
command_arg
move_file_args
[]
=
{
{
"from_file"
,
ARG_STRING
,
TRUE
,
&
ds_from_file
,
"Filename to move from"
},
{
"to_file"
,
ARG_STRING
,
TRUE
,
&
ds_to_file
,
"Filename to move to"
}
};
DBUG_ENTER
(
"do_move_file"
);
check_command_args
(
command
,
command
->
first_argument
,
move_file_args
,
sizeof
(
move_file_args
)
/
sizeof
(
struct
command_arg
),
' '
);
DBUG_PRINT
(
"info"
,
(
"Move %s to %s"
,
ds_from_file
.
str
,
ds_to_file
.
str
));
error
=
(
my_rename
(
ds_from_file
.
str
,
ds_to_file
.
str
,
MYF
(
0
))
!=
0
);
handle_command_error
(
command
,
error
);
dynstr_free
(
&
ds_from_file
);
dynstr_free
(
&
ds_to_file
);
DBUG_VOID_RETURN
;
}
/*
SYNOPSIS
do_chmod_file
...
...
@@ -7691,6 +7729,7 @@ int main(int argc, char **argv)
case
Q_CHANGE_USER
:
do_change_user
(
command
);
break
;
case
Q_CAT_FILE
:
do_cat_file
(
command
);
break
;
case
Q_COPY_FILE
:
do_copy_file
(
command
);
break
;
case
Q_MOVE_FILE
:
do_move_file
(
command
);
break
;
case
Q_CHMOD_FILE
:
do_chmod_file
(
command
);
break
;
case
Q_PERL
:
do_perl
(
command
);
break
;
case
Q_DELIMITER
:
...
...
mysql-test/r/mysqltest.result
View file @
444bbe56
...
...
@@ -545,6 +545,8 @@ mysqltest: At line 1: Failed to open file 'non_existing_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'from_file' to command 'move_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'move_file'
mysqltest: At line 1: Missing required argument 'mode' to command 'chmod'
mysqltest: At line 1: You must write a 4 digit octal number for mode
mysqltest: At line 1: You must write a 4 digit octal number for mode
...
...
mysql-test/t/mysqltest.test
View file @
444bbe56
...
...
@@ -1780,6 +1780,56 @@ remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
--
error
1
--
exec
echo
"copy_file from_file;"
|
$MYSQL_TEST
2
>&
1
# ----------------------------------------------------------------------------
# test for move_file
# ----------------------------------------------------------------------------
# - Check that if source file does not exist, nothing will be created.
--
error
1
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
;
--
error
1
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
--
error
1
move_file
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
--
error
1
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
;
--
error
1
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
# - Check that if source file exists, everything works properly.
--
write_file
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
file1
EOF
move_file
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
--
error
1
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
;
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
# - Check that if destination file exists, everything works properly.
# (file2.tmp exists from the previous check; file1.tmp needs to be created)
--
write_file
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
file1
EOF
move_file
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
--
error
1
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file1
.
tmp
;
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
file2
.
tmp
;
# - Check usage.
--
error
1
--
exec
echo
"move_file ;"
|
$MYSQL_TEST
2
>&
1
--
error
1
--
exec
echo
"move_file from_file;"
|
$MYSQL_TEST
2
>&
1
# ----------------------------------------------------------------------------
# test for chmod
# ----------------------------------------------------------------------------
...
...
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