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

Merge branch 'master' of github.com:NixOS/nix

This commit is contained in:
siddhantCodes 2024-05-13 18:43:12 +05:30
commit 39e8aad446
12 changed files with 178 additions and 112 deletions

View file

@ -225,7 +225,7 @@ void LocalStore::findRoots(const Path & path, std::filesystem::file_type type, R
try {
if (type == std::filesystem::file_type::unknown)
type = getFileType(path);
type = std::filesystem::symlink_status(path).type();
if (type == std::filesystem::file_type::directory) {
for (auto & i : std::filesystem::directory_iterator{path})

View file

@ -12,7 +12,7 @@ void IndirectRootStore::makeSymlink(const Path & link, const Path & target)
createSymlink(target, tempLink);
/* Atomically replace the old one. */
renameFile(tempLink, link);
std::filesystem::rename(tempLink, link);
}
Path IndirectRootStore::addPermRoot(const StorePath & storePath, const Path & _gcRoot)

View file

@ -64,7 +64,7 @@ protected:
AutoDelete del(tmp, false);
StreamToSourceAdapter source(istream);
writeFile(tmp, source);
renameFile(tmp, path2);
std::filesystem::rename(tmp, path2);
del.cancel();
}

View file

@ -1779,7 +1779,7 @@ void LocalStore::addBuildLog(const StorePath & drvPath, std::string_view log)
writeFile(tmpFile, compress("bzip2", log));
renameFile(tmpFile, logPath);
std::filesystem::rename(tmpFile, logPath);
}
std::optional<std::string> LocalStore::getVersion()

View file

@ -783,7 +783,7 @@ static void movePath(const Path & src, const Path & dst)
if (changePerm)
chmod_(src, st.st_mode | S_IWUSR);
renameFile(src, dst);
std::filesystem::rename(src, dst);
if (changePerm)
chmod_(dst, st.st_mode);

View file

@ -285,7 +285,7 @@ static void movePath(const Path & src, const Path & dst)
if (changePerm)
chmod_(src, st.st_mode | S_IWUSR);
renameFile(src, dst);
std::filesystem::rename(src, dst);
if (changePerm)
chmod_(dst, st.st_mode);
@ -372,7 +372,7 @@ bool LocalDerivationGoal::cleanupDecideWhetherDiskFull()
if (buildMode != bmCheck && status.known->isValid()) continue;
auto p = worker.store.toRealPath(status.known->path);
if (pathExists(chrootRootDir + p))
renameFile((chrootRootDir + p), p);
std::filesystem::rename((chrootRootDir + p), p);
}
return diskFull;
@ -421,7 +421,9 @@ static void doBind(const Path & source, const Path & target, bool optional = fal
} else if (S_ISLNK(st.st_mode)) {
// Symlinks can (apparently) not be bind-mounted, so just copy it
createDirs(dirOf(target));
copyFile(source, target, /* andDelete */ false);
copyFile(
std::filesystem::path(source),
std::filesystem::path(target), false);
} else {
createDirs(dirOf(target));
writeFile(target, "");
@ -2568,8 +2570,11 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
// Replace the output by a fresh copy of itself to make sure
// that there's no stale file descriptor pointing to it
Path tmpOutput = actualPath + ".tmp";
copyFile(actualPath, tmpOutput, true);
renameFile(tmpOutput, actualPath);
copyFile(
std::filesystem::path(actualPath),
std::filesystem::path(tmpOutput), true);
std::filesystem::rename(tmpOutput, actualPath);
auto newInfo0 = newInfoFromCA(DerivationOutput::CAFloating {
.method = dof.ca.method,

View file

@ -27,7 +27,7 @@ void builtinUnpackChannel(
if (fileCount != 1)
throw Error("channel tarball '%s' contains more than one file", src);
renameFile(fileName, (out + "/" + channelName));
std::filesystem::rename(fileName, (out + "/" + channelName));
}
}