From a34ae9cfcf47563056f663999a3c885a8c282f79 Mon Sep 17 00:00:00 2001 From: Tony Tye Date: Sat, 9 Jan 2021 11:03:33 +0000 Subject: [PATCH] Ensure dump file names do not contain special characters When TargetID is supported, the isa name will contain ':' characters that are not legal in Windows file names. So replace all non-aphanumeric or '+'/'-' characters with '_' to ensure the file name will be legal on any file system. Change-Id: I0b73a6188c186f75f1d2e8af19ade87667cbfe0b [ROCm/clr commit: ed6d54b416a114854482211c96d6c2dc96207227] --- projects/clr/rocclr/compiler/lib/utils/options.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/clr/rocclr/compiler/lib/utils/options.cpp b/projects/clr/rocclr/compiler/lib/utils/options.cpp index 9f58337698..6ca837afae 100644 --- a/projects/clr/rocclr/compiler/lib/utils/options.cpp +++ b/projects/clr/rocclr/compiler/lib/utils/options.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "options.hpp" namespace { @@ -1552,7 +1553,9 @@ Options::setDumpFileName(const char* val) } std::stringstream prefix; - prefix << dumpPrefix << "_" << buildNo << "_" << val; + // Replace characters in the file name that are not legal with '_'. + prefix << dumpPrefix << "_" << buildNo << "_" + << std::regex_replace(val, std::regex("[:]"), "_"); dumpFileRoot = prefix.str(); // Check whether the length of path meets the system limits