Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Commit e200870

Browse files
committed
Merge pull request #18 from gzm0/fix-log-path-replacement
Properly quote regex replacement string in path canonicalization
2 parents bcdbb90 + a52d6ec commit e200870

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/scala/scala/tools/partest/nest/Runner.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
311311
* any Windows backslashes with the one true file separator char.
312312
*/
313313
def normalizeLog() {
314+
import scala.util.matching.Regex
315+
314316
// Apply judiciously; there are line comments in the "stub implementations" error output.
315317
val slashes = """[/\\]+""".r
316318
def squashSlashes(s: String) = slashes replaceAllIn (s, "/")
@@ -324,7 +326,8 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
324326
// no spaces in test file paths below root, because otherwise how to detect end of path string?
325327
val pathFinder = raw"""(?i)\Q${elided}${File.separator}\E([\${File.separator}\S]*)""".r
326328
def canonicalize(s: String): String = (
327-
pathFinder replaceAllIn (s, m => ellipsis + squashSlashes(m group 1))
329+
pathFinder replaceAllIn (s, m =>
330+
Regex.quoteReplacement(ellipsis + squashSlashes(m group 1)))
328331
)
329332

330333
def masters = {

0 commit comments

Comments
 (0)