Skip to content

Commit

Permalink
Revert "[NFC][libFuzzer] Prefix TempPath with string showing the work…
Browse files Browse the repository at this point in the history
… it is doing."

This reverts commit 8a29cb4.

fuzzer-linux bot has failure because of this.
  • Loading branch information
Yuanfang Chen committed Feb 11, 2020
1 parent 52086f8 commit b1c7623
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions compiler-rt/lib/fuzzer/FuzzerDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ int CleanseCrashInput(const Vector<std::string> &Args,
assert(Cmd.hasArgument(InputFilePath));
Cmd.removeArgument(InputFilePath);

auto TmpFilePath = TempPath("CleanseCrashInput", ".repro");
auto TmpFilePath = TempPath(".repro");
Cmd.addArgument(TmpFilePath);
Cmd.setOutputFile(getDevNull());
Cmd.combineOutAndErr();
Expand Down Expand Up @@ -499,7 +499,7 @@ void Merge(Fuzzer *F, FuzzingOptions &Options, const Vector<std::string> &Args,
std::sort(OldCorpus.begin(), OldCorpus.end());
std::sort(NewCorpus.begin(), NewCorpus.end());

std::string CFPath = CFPathOrNull ? CFPathOrNull : TempPath("Merge", ".txt");
std::string CFPath = CFPathOrNull ? CFPathOrNull : TempPath(".txt");
Vector<std::string> NewFiles;
Set<uint32_t> NewFeatures, NewCov;
CrashResistantMerge(Args, OldCorpus, NewCorpus, &NewFiles, {}, &NewFeatures,
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/fuzzer/FuzzerFork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,
for (auto &Dir : CorpusDirs)
GetSizedFilesFromDir(Dir, &SeedFiles);
std::sort(SeedFiles.begin(), SeedFiles.end());
Env.TempDir = TempPath("FuzzWithFork", ".dir");
Env.TempDir = TempPath(".dir");
Env.DFTDir = DirPlusFile(Env.TempDir, "DFT");
RmDirRecursive(Env.TempDir); // in case there is a leftover from old runs.
MkDir(Env.TempDir);
Expand Down
5 changes: 3 additions & 2 deletions compiler-rt/lib/fuzzer/FuzzerIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ void RmDirRecursive(const std::string &Dir) {
[](const std::string &Path) { RemoveFile(Path); });
}

std::string TempPath(const char *Prefix, const char *Extension) {
return DirPlusFile(TmpDir(), Prefix + std::to_string(GetPid()) + Extension);
std::string TempPath(const char *Extension) {
return DirPlusFile(TmpDir(),
"libFuzzerTemp." + std::to_string(GetPid()) + Extension);
}

} // namespace fuzzer
2 changes: 1 addition & 1 deletion compiler-rt/lib/fuzzer/FuzzerIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ std::string DirName(const std::string &FileName);
// Returns path to a TmpDir.
std::string TmpDir();

std::string TempPath(const char *Prefix, const char *Extension);
std::string TempPath(const char *Extension);

bool IsInterestingCoverageFile(const std::string &FileName);

Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/fuzzer/FuzzerLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void Fuzzer::ExitCallback() {
void Fuzzer::MaybeExitGracefully() {
if (!F->GracefulExitRequested) return;
Printf("==%lu== INFO: libFuzzer: exiting as requested\n", GetPid());
RmDirRecursive(TempPath("FuzzWithFork", ".dir"));
RmDirRecursive(TempPath(".dir"));
F->PrintFinalStats();
_Exit(0);
}
Expand All @@ -265,7 +265,7 @@ void Fuzzer::InterruptCallback() {
Printf("==%lu== libFuzzer: run interrupted; exiting\n", GetPid());
PrintFinalStats();
ScopedDisableMsanInterceptorChecks S; // RmDirRecursive may call opendir().
RmDirRecursive(TempPath("FuzzWithFork", ".dir"));
RmDirRecursive(TempPath(".dir"));
// Stop right now, don't perform any at-exit actions.
_Exit(Options.InterruptExitCode);
}
Expand Down

0 comments on commit b1c7623

Please sign in to comment.