Skip to content

Commit

Permalink
When trying to migrate a file system from CryFS 0.9.3 or older, show …
Browse files Browse the repository at this point in the history
…an error message suggesting to first open it with 0.9.10 because we can't load that anymore.
  • Loading branch information
smessmer committed Feb 10, 2019
1 parent 97c9ac4 commit 5a5f8f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
Expand Up @@ -2,6 +2,7 @@ Version 0.10.1 (unreleased)
---------------
Fixed bugs:
* If file system migration encounters files or folders with the wrong format in the base directory, it now just ignores them instead of crashing.
* When trying to migrate a file system from CryFS 0.9.3 or older, show an error message suggesting to first open it with 0.9.10 because we can't load that anymore.


Version 0.10.0
Expand Down
9 changes: 3 additions & 6 deletions src/cryfs/config/CryConfigLoader.cpp
Expand Up @@ -43,12 +43,6 @@ optional<CryConfigLoader::ConfigLoadResult> CryConfigLoader::_loadConfig(bf::pat
}
#endif
_checkVersion(*config->config(), allowFilesystemUpgrade);
#ifndef CRYFS_NO_COMPATIBILITY
//Since 0.9.3-alpha set the config value cryfs.blocksizeBytes wrongly to 32768 (but didn't use the value), we have to fix this here.
if (config->config()->Version() != "0+unknown" && VersionCompare::isOlderThan(config->config()->Version(), "0.9.3-rc1")) {
config->config()->SetBlocksizeBytes(32832);
}
#endif
if (config->config()->Version() != CryConfig::FilesystemFormatVersion) {
config->config()->SetVersion(CryConfig::FilesystemFormatVersion);
config->save();
Expand All @@ -65,6 +59,9 @@ optional<CryConfigLoader::ConfigLoadResult> CryConfigLoader::_loadConfig(bf::pat
}

void CryConfigLoader::_checkVersion(const CryConfig &config, bool allowFilesystemUpgrade) {
if (gitversion::VersionCompare::isOlderThan(config.Version(), "0.9.4")) {
throw CryfsException("This filesystem is for CryFS " + config.Version() + ". This format is not supported anymore. Please migrate the file system to a supported version first by opening it with CryFS 0.9.x (x>=4).", ErrorCode::TooOldFilesystemFormat);
}
if (gitversion::VersionCompare::isOlderThan(CryConfig::FilesystemFormatVersion, config.Version())) {
if (!_console->askYesNo("This filesystem is for CryFS " + config.Version() + " or later and should not be opened with older versions. It is strongly recommended to update your CryFS version. However, if you have backed up your base directory and know what you're doing, you can continue trying to load it. Do you want to continue?", false)) {
throw CryfsException("This filesystem is for CryFS " + config.Version() + " or later. Please update your CryFS version.", ErrorCode::TooNewFilesystemFormat);
Expand Down

0 comments on commit 5a5f8f7

Please sign in to comment.