Skip to content
Snippets Groups Projects
Verified Commit bad0c3cf authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Fix preprocessor failure to rename +<model> directory if /tmp is not on the same filesystem

Bug introduced in 0c755460, that manifested on the Gitlab runners.
parent 2c6fa34a
Branches
No related tags found
No related merge requests found
......@@ -853,7 +853,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
macOS), if we directly remove the "+" subdirectory, then the
preprocessor is not able to recreate it afterwards (presumably because
MATLAB maintains some sort of lock on it). The workaround is to rename
it before deleting it. */
it before deleting it (the renaming must occur in the same directory,
otherwise it may file if the destination is not on the same
filesystem). */
if (filesystem::exists("+" + basename))
{
auto tmp = unique_path();
......@@ -1582,7 +1584,7 @@ ModFile::unique_path()
string rand_str(rand_length, '\0');
for (auto &dis : rand_str)
dis = possible_characters[distribution(generator)];
path = filesystem::temp_directory_path() / rand_str;
path = rand_str;
}
while (filesystem::exists(path));
......
......@@ -131,7 +131,7 @@ private:
void writeJsonComputingPassOutput(const string &basename, JsonFileOutputType json_output_mode, bool jsonderivsimple) const;
void writeJsonFileHelper(const string &fname, ostringstream &output) const;
vector<expr_t> pac_growth;
/* Generate a random temporary path. Equivalent to
/* Generate a random temporary path, in the current directory. Equivalent to
boost::filesystem::unique_path(). Both are insecure, but currently there
is no better portable solution. Maybe in a later C++ standard? */
static filesystem::path unique_path();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment