1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00

Ensure that curSchema is set before opening the DB

Without this, it's possible to get `curSchema = 0` which then causes us
not to trigger the branch that maintains forward compatibility with the
1.12 schema.

Fixes #1332
This commit is contained in:
Dan Peebles 2017-04-14 14:44:28 -04:00
parent eb6f3d5159
commit ad9e6037a4

View file

@ -225,6 +225,7 @@ LocalStore::LocalStore(bool reserveSpace)
schemaPath = settings.nixDBPath + "/schema"; schemaPath = settings.nixDBPath + "/schema";
if (settings.readOnlyMode) { if (settings.readOnlyMode) {
curSchema = getSchema();
openDB(false); openDB(false);
return; return;
} }
@ -309,6 +310,7 @@ LocalStore::LocalStore(bool reserveSpace)
} catch (SysError & e) { } catch (SysError & e) {
if (e.errNo != EACCES) throw; if (e.errNo != EACCES) throw;
settings.readOnlyMode = true; settings.readOnlyMode = true;
curSchema = getSchema();
openDB(false); openDB(false);
return; return;
} }