libstore: drop support for db schema version 7
the upgrade to version 7 was done in 2013. it's about time. Change-Id: I4520cfd1a13b693259ae71710d04f42a1303eb5d
This commit is contained in:
@@ -322,6 +322,12 @@ LocalStore::LocalStore(LocalStoreConfig config)
|
||||
"which is no longer supported. To convert to the new format,\n"
|
||||
"please use the original Nix version 1.11 first.");
|
||||
|
||||
if (curSchema < 7)
|
||||
throw Error(
|
||||
"Your Nix store may contain immutable inodes, "
|
||||
"which is no longer supported. To convert to the new format "
|
||||
"please run the original Lix version 2.92 first.");
|
||||
|
||||
if (!tryLockFile(globalLock.get(), ltWrite)) {
|
||||
printInfo("waiting for exclusive access to the Nix store...");
|
||||
unlockFile(globalLock.get()); // We have acquired a shared lock; release it to prevent deadlocks
|
||||
@@ -332,8 +338,6 @@ LocalStore::LocalStore(LocalStoreConfig config)
|
||||
have performed the upgrade already. */
|
||||
curSchema = getSchema();
|
||||
|
||||
if (curSchema < 7) { upgradeStore7(); }
|
||||
|
||||
openDB(*state, false);
|
||||
|
||||
if (curSchema < 8) {
|
||||
@@ -1715,58 +1719,6 @@ std::optional<TrustedFlag> LocalStore::isTrustedClient()
|
||||
}
|
||||
|
||||
|
||||
#if defined(FS_IOC_SETFLAGS) && defined(FS_IOC_GETFLAGS) && defined(FS_IMMUTABLE_FL)
|
||||
|
||||
static void makeMutable(const Path & path)
|
||||
{
|
||||
checkInterrupt();
|
||||
|
||||
auto st = lstat(path);
|
||||
|
||||
if (!S_ISDIR(st.st_mode) && !S_ISREG(st.st_mode)) return;
|
||||
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
for (auto & i : readDirectory(path))
|
||||
makeMutable(path + "/" + i.name);
|
||||
}
|
||||
|
||||
/* The O_NOFOLLOW is important to prevent us from changing the
|
||||
mutable bit on the target of a symlink (which would be a
|
||||
security hole). */
|
||||
AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||
if (fd == -1) {
|
||||
if (errno == ELOOP) return; // it's a symlink
|
||||
throw SysError("opening file '%1%'", path);
|
||||
}
|
||||
|
||||
unsigned int flags = 0, old;
|
||||
|
||||
/* Silently ignore errors getting/setting the immutable flag so
|
||||
that we work correctly on filesystems that don't support it. */
|
||||
if (ioctl(fd, FS_IOC_GETFLAGS, &flags)) return;
|
||||
old = flags;
|
||||
flags &= ~FS_IMMUTABLE_FL;
|
||||
if (old == flags) return;
|
||||
if (ioctl(fd, FS_IOC_SETFLAGS, &flags)) return;
|
||||
}
|
||||
|
||||
/* Upgrade from schema 6 (Nix 0.15) to schema 7 (Nix >= 1.3). */
|
||||
void LocalStore::upgradeStore7()
|
||||
{
|
||||
if (getuid() != 0) return;
|
||||
printInfo("removing immutable bits from the Nix store (this may take a while)...");
|
||||
makeMutable(config_.realStoreDir);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void LocalStore::upgradeStore7()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void LocalStore::addSignatures(const StorePath & storePath, const StringSet & sigs)
|
||||
{
|
||||
retrySQLite([&]() {
|
||||
|
||||
@@ -350,8 +350,6 @@ private:
|
||||
|
||||
void updatePathInfo(DBState & state, const ValidPathInfo & info);
|
||||
|
||||
void upgradeStore6();
|
||||
void upgradeStore7();
|
||||
PathSet queryValidPathsOld();
|
||||
ValidPathInfo queryPathInfoOld(const Path & path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user