Only repair backups if repairing

This commit is contained in:
Dennis Schwerdel 2017-04-16 23:18:25 +02:00
parent 66e56b9b0c
commit 1617fecb92
2 changed files with 11 additions and 3 deletions

View File

@ -8,8 +8,10 @@ This project follows [semantic versioning](http://semver.org).
* [added] Added date to bundles * [added] Added date to bundles
* [modified] Logging to stderr * [modified] Logging to stderr
* [modified] Enforce deterministic bundle ordering * [modified] Enforce deterministic bundle ordering
* [modified] More info in analyze subcommand
* [fixed] Only print "repairing bundles" if actually repairing bundles * [fixed] Only print "repairing bundles" if actually repairing bundles
* [fixed] Only put mode bits of st_mode into metadata * [fixed] Only put mode bits of st_mode into metadata
* [fixed] Only repairing backups with --repair
### v0.2.0 (2017-04-14) ### v0.2.0 (2017-04-14)

View File

@ -135,11 +135,13 @@ impl Repository {
*chunks = c; *chunks = c;
modified = true; modified = true;
}, },
Err(err) => { Err(err) => if repair {
warn!("Problem detected: inode {:?} is corrupt\n\tcaused by: {}", path.join(name), err); warn!("Problem detected: inode {:?} is corrupt\n\tcaused by: {}", path.join(name), err);
info!("Removing broken inode from backup"); info!("Removing broken inode from backup");
removed.push(name.to_string()); removed.push(name.to_string());
modified = true; modified = true;
} else {
return Err(err)
} }
} }
} }
@ -185,9 +187,11 @@ impl Repository {
try!(self.evacuate_broken_backup(&name)); try!(self.evacuate_broken_backup(&name));
try!(self.save_backup(&backup, &name)); try!(self.save_backup(&backup, &name));
}, },
Err(err) => { Err(err) => if repair {
warn!("The root of the backup {} has been corrupted\n\tcaused by: {}", name, err); warn!("The root of the backup {} has been corrupted\n\tcaused by: {}", name, err);
try!(self.evacuate_broken_backup(&name)); try!(self.evacuate_broken_backup(&name));
} else {
return Err(err)
} }
} }
Ok(()) Ok(())
@ -285,9 +289,11 @@ impl Repository {
try!(self.evacuate_broken_backup(&name)); try!(self.evacuate_broken_backup(&name));
try!(self.save_backup(&backup, &name)); try!(self.save_backup(&backup, &name));
}, },
Err(err) => { Err(err) => if repair {
warn!("The root of the backup {} has been corrupted\n\tcaused by: {}", name, err); warn!("The root of the backup {} has been corrupted\n\tcaused by: {}", name, err);
try!(self.evacuate_broken_backup(&name)); try!(self.evacuate_broken_backup(&name));
} else {
return Err(err)
} }
} }
} }