Bug #51861 my_rename on windows: check that "from" exists
| Submitted: | 9 Mar 2010 11:32 | Modified: | 4 Aug 2010 20:02 |
|---|---|---|---|
| Reporter: | jack andrews | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Windows | Severity: | S3 (Non-critical) |
| Version: | OS: | Windows | |
| Assigned to: | jack andrews | CPU Architecture: | Any |
[9 Mar 2010 17:25]
Jonas Oreland
sounds like a plan commit a patch for 5.1-mainline have it accepted there then we'll merge into our branch when times come
[10 Mar 2010 4:03]
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/102813 3361 Jack Andrews 2010-03-10 Bug #51861 my_rename on windows: check that "from" exists . use MoveFileEx() . i'd like to write a test case but unsure how it's done - what configure options - using tap?
[17 Mar 2010 19:52]
Vladislav Vaintroub
looks good, ok to push when merging to 5.5 (next-mr-bugfixing?), please use my_osmaperr(GetLastError()); instead of setting errno to EACCES directly.
[22 Mar 2010 1:45]
jack andrews
reggie,
just checking my use of my_osmaperr() is correct.
thanks.
C:\repo\mysql-next-mr-bugfixing>bzr diff
=== modified file 'mysys/my_rename.c'
--- mysys/my_rename.c 2010-03-10 03:58:37 +0000
+++ mysys/my_rename.c 2010-03-22 01:42:52 +0000
@@ -47,7 +47,7 @@
if(!MoveFileEx(from, to, MOVEFILE_COPY_ALLOWED|
MOVEFILE_REPLACE_EXISTING))
{
- my_errno=EACCES;
+ my_osmaperr(GetLastError());
#else
#if defined(HAVE_RENAME)
if (rename(from,to))
[22 Mar 2010 2:14]
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/103918 3137 Jack Andrews 2010-03-22 Bug #51861 my_rename on windows: check that "from" exists
[23 Mar 2010 14:05]
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/104089 3140 Vladislav Vaintroub 2010-03-23 Post-fix for Bug#51861: set my_error to errno
[23 Mar 2010 14:09]
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/104090 3140 Vladislav Vaintroub 2010-03-23 Post-fix for Bug#51861: set my_error to errno
[24 Mar 2010 8:14]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100324081249-yfwol7qtcek6dh7w) (version source revid:alik@sun.com-20100324081113-kc7x1iytnplww91u) (merge vers: 6.0.14-alpha) (pib:16)
[24 Mar 2010 8:17]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100324081159-5b8juv8ldiqwce8v) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (pib:16)
[17 May 2010 3:50]
jack andrews
pushed to cluster 7.0 + merged to 7.1
[19 May 2010 14:12]
Paul DuBois
Noted in 6.0.14 changelog. On Windows, the my_rename() function failed to check whether the source file existed.
[4 Aug 2010 8:03]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 8:19]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 20:02]
Paul DuBois
Noted in 5.6.0 changelog.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.072 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.
Description: my_rename removes any "conflicting files" without checking that the "from" path exists. How to repeat: . Suggested fix: > --- mysys/my_rename.c 2007-10-11 15:07:40 +0000 > +++ mysys/my_rename.c 2008-11-19 20:31:54 +0000 > @@ -47,8 +47,19 @@ int my_rename(const char *from, const ch > #if defined(__WIN__) || defined(__NETWARE__) > /* > On windows we can't rename over an existing file: > - Remove any conflicting files: > + Remove any conflicting files: but first check that "from" exists > */ > + { > + int save_errno; > + MY_STAT my_stat_result; > + save_errno=my_errno; > + if (my_stat(from ,&my_stat_result,MYF(0)) == 0) > + { > + my_errno=ENOENT; > + DBUG_RETURN(-1); > + } > + my_errno=save_errno; > + } > (void) my_delete(to, MYF(0)); > #endif > if (rename(from,to))