Skip to content

Bug: pathsMatch can produce false positives (no directory boundary check) #7

@astefano

Description

@astefano

Description

In ProbeLean/Verify.lean, the pathsMatch function uses String.endsWith without a directory boundary guard:

def pathsMatch (path1 : String) (path2 : String) : Bool :=
  path1 == path2 ||
  path1.endsWith path2 ||
  path2.endsWith path1 ||
  normalizePathForMatch path1 == normalizePathForMatch path2

Example: pathsMatch "ATest.lean" "Test.lean" returns true even though they are different files. This could cause sorry warnings from one file to be incorrectly attributed to atoms in another file with a similar-suffix name.

Suggested Fix

Check for a path separator before the suffix match:

path1.endsWith ("/" ++ path2) || path1 == path2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions