Revert "libstore: make temporary path prefixes optional"
Revert submission 3850 Reason for revert: caused multiple regressions noticed in https://git.lix.systems/lix-project/lix/issues/975 and https://git.lix.systems/lix-project/lix/issues/966 (suspected). Root cause analysis has not been done yet and this breaks Lix on Darwin on HEAD. Reverted changes: /q/submissionid:3850 Change-Id: Ib4d3179cbfa8e9f861d7416fe08f7d7e3a7d55e2
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace nix {
|
||||
|
||||
Path createTempDir(const std::optional<Path> & prefix, mode_t mode)
|
||||
Path createTempDir(const Path & prefix, mode_t mode)
|
||||
{
|
||||
return createTempSubdir(defaultTempDir(), prefix, mode);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace nix {
|
||||
/**
|
||||
* Create a temporary directory.
|
||||
*/
|
||||
Path createTempDir(const std::optional<Path> & prefix = "nix", mode_t mode = 0755);
|
||||
Path createTempDir(const Path & prefix = "nix", mode_t mode = 0755);
|
||||
|
||||
/**
|
||||
* Create a temporary file, returning a file handle and its path.
|
||||
|
||||
@@ -646,7 +646,7 @@ void AutoDelete::reset(const Path & p, bool recursive) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Path createTempSubdir(const Path & parent, const std::optional<Path> & prefix,
|
||||
Path createTempSubdir(const Path & parent, const Path & prefix,
|
||||
mode_t mode)
|
||||
{
|
||||
checkInterrupt();
|
||||
@@ -670,7 +670,7 @@ Path createTempSubdir(const Path & parent, const std::optional<Path> & prefix,
|
||||
throw SysError("creating directory '%1%'", tmpDir);
|
||||
}
|
||||
|
||||
Path makeTempPath(const Path & root, const std::optional<Path> & prefix)
|
||||
Path makeTempPath(const Path & root, const Path & prefix)
|
||||
{
|
||||
static thread_local std::random_device generator{};
|
||||
std::uniform_int_distribution<uint64_t> uniform_dist{};
|
||||
@@ -679,11 +679,7 @@ Path makeTempPath(const Path & root, const std::optional<Path> & prefix)
|
||||
reinterpret_cast<const char *>(entropy),
|
||||
sizeof(entropy)
|
||||
));
|
||||
if (prefix) {
|
||||
return fmt("%s%s-%s", root, *prefix, unique);
|
||||
} else {
|
||||
return root + unique;
|
||||
}
|
||||
return fmt("%s%s-%s", root, prefix, unique);
|
||||
}
|
||||
|
||||
Path makeTempSiblingPath(const Path & path)
|
||||
|
||||
@@ -307,16 +307,16 @@ typedef std::unique_ptr<DIR, DIRDeleter> AutoCloseDir;
|
||||
/**
|
||||
* Create a temporary directory in a given parent directory.
|
||||
*/
|
||||
Path createTempSubdir(const Path & parent, const std::optional<Path> & prefix = "nix",
|
||||
Path createTempSubdir(const Path & parent, const Path & prefix = "nix",
|
||||
mode_t mode = 0755);
|
||||
|
||||
/**
|
||||
* Return temporary path constructed by appending to a root path.
|
||||
*
|
||||
* The constructed path looks like `<root>[<prefix>-]<unique>`. To create a
|
||||
* The constructed path looks like `<root><prefix>-<unique>`. To create a
|
||||
* path nested in a directory, provide a root ending with `/`.
|
||||
*/
|
||||
Path makeTempPath(const Path & root, const std::optional<Path> & prefix = ".tmp");
|
||||
Path makeTempPath(const Path & root, const Path & prefix = ".tmp");
|
||||
|
||||
/**
|
||||
* Return temporary path in the same directory as a given path.
|
||||
|
||||
Reference in New Issue
Block a user