Bug #33119 online backup silently overwrites files.
Submitted: 10 Dec 2007 18:09 Modified: 26 Feb 2008 1:48
Reporter: Rafal Somla Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S2 (Serious)
Version:6.0 OS:Any
Assigned to: Rafal Somla CPU Architecture:Any

[10 Dec 2007 18:09] Rafal Somla
Description:
When BACKUP DATABASE ... TO <file> command is executed, no checks are made to
see if <file> exists already. If this is the case, the file will be silently overwritten with the contents of the backup image. 

How to repeat:
Issue "BACKUP DATABASE test TO </path/to/your/valuable/file>"

Suggested fix:
BACKUP command should detect that the backup destination file exists and report error in that case.
[11 Dec 2007 10:22] 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/39697

ChangeSet@1.2748, 2007-12-11 11:21:35+01:00, rafal@quant.(none) +10 -0
  BUG#33119 (Online backup silently overwrites files).
  
  This patch makes backup to fail with error "Can't write to backup location '<path>'" if the
  file already exists. Backup tests are updated so that they don't try to overwrite existing
  files.
  
  Also, in case of failed BACKUP operation, the backup file is deleted if it was created at 
  its beginning.
[12 Dec 2007 20:25] 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/39820

ChangeSet@1.2748, 2007-12-12 21:23:23+01:00, rafal@quant.(none) +14 -0
  BUG#33119 (Online backup silently overwrites files).
  
  This patch makes backup to fail with error "Can't write to backup location 
  '<path>'" if the file already exists. Backup tests are updated so that they 
  don't try to overwrite existing files.
  
  Also, in case of failed BACKUP operation, the backup file is deleted if it was 
  created at its beginning.
[13 Dec 2007 7:09] Rafal Somla
The patch for this bug fixes also BUG#32385 and BUG#32834.
[13 Dec 2007 15:52] 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/39902

ChangeSet@1.2748, 2007-12-13 16:51:50+01:00, rafal@quant.(none) +15 -0
  BUG#33119 (Online backup silently overwrites files).
  
  This patch makes backup to fail with error "Can't write to backup location 
  '<path>'" if the file already exists. Backup tests are updated so that they 
  don't try to overwrite existing files.
  
  Also, in case of failed BACKUP operation, the backup file is deleted if it was 
  created at its beginning.
[13 Dec 2007 16:42] Rafal Somla
Approved by Lars per his review email.
[13 Dec 2007 16:52] 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/39909

ChangeSet@1.2748, 2007-12-13 17:50:01+01:00, rafal@quant.(none) +15 -0
  BUG#33119 (Online backup silently overwrites files).
  
  This patch makes backup to fail with error "Can't write to backup location 
  '<path>'" if the file already exists. Backup tests are updated so that they 
  don't try to overwrite existing files.
  
  Also, in case of failed BACKUP operation, the backup file is deleted if it was 
  created at its beginning.
[14 Dec 2007 16:25] Rafal Somla
Pushed into 6.0-backup tree.
[25 Feb 2008 20:19] Bugs System
Pushed into 6.0.5-alpha
[26 Feb 2008 1:48] Paul DuBois
Noted in 6.0.5 changelog.

BACKUP DATABASE should fail if the output file already exists, but
was silently overwriting any existing file.
[14 Mar 2008 1:33] Paul DuBois
Correction: No changelog entry needed; this bug did not appear in any released version.