Repository navigation
Mutate the classes of a project whose path holds a comma - #35
Merged
Merged
Conversation
In a project whose directory path held a comma, pitestDiff and
cribro:pitest-diff mutated nothing and reported
no mutant: no changed line has bytecode PIT may mutate
PIT splits --mutableCodePaths at commas, so .../a,b/build/classes/java/main
reached it as two entries that match no classpath entry. A path with a {
made PIT fail with a PatternSyntaxException, and one with a ^ or a |
matched nothing, since PIT turns each entry into a regular expression
without escaping them.
PIT reads an entry that starts with ~ as a regular expression, so each
path now goes to PIT as ~ followed by Pattern.quote of the path, with
every comma written as \x2C and every plus as \x2B: PIT escapes a + even
in that form. The entry matches the path and nothing else. Writing the
comma as the glob ? was rejected: it also matches a sibling directory
whose name has another character there.
Leaving a source directory with a comma out of --sourceDirs was
rejected too: with every directory left out the value is empty, which
PIT reads as its working directory, and without the option PIT fails
with a NullPointerException.
User-visible:
In a project whose directory path holds a comma, a brace, a caret, or a vertical bar, pitestDiff and cribro:pitest-diff mutate the changed lines.
Not changed:
PIT splits --sourceDirs at commas too and has no escape for them, so in a project whose path holds a comma, PIT's HTML report shows a mutated file without its source, or with the source of a file of the same name in another directory.
Fixes cribro-dev#30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vlsi
force-pushed
the
mutable-code-path-comma
branch
from
December 1, 2026 08:36
a1211c5 to
e84e750
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a project whose directory path holds a comma,
pitestDiffandcribro:pitest-diffmutated nothing and reportedno mutant: no changed line has bytecode PIT may mutate, because PIT splits--mutableCodePathsat commas. A{in the path made PIT fail with aPatternSyntaxException, and a^or a|matched nothing, since PIT turns each entry into a regular expression without escaping them.Each path now goes to PIT as
~followed byPattern.quoteof the path, with every comma written as\x2Cand every plus as\x2B, sinceGlobescapes a+even in the~form. The entry matches the path and nothing else. Writing the comma as the glob?was rejected: it also matches a sibling directory whose name has another character there, and the test has such a sibling.Scope. PIT splits
--sourceDirsat commas too and has no escape for them, so in such a project PIT's HTML report, which the mutation report links, shows a mutated file without its source, or with the source of a file of the same name in another directory, such as an older checkoutprojbesideproj,v2. Leaving such directories out was rejected: with every directory left out the value is empty, which PIT reads as its working directory, and without the option PIT fails with aNullPointerException. Reported upstream as hcoles/pitest#1516.Fixes #30
🤖 Generated with Claude Code