Skip to content

OpamFilename.starts_with is incorrect #6948

@rjbou

Description

@rjbou

The current implementation of OpamFilename.starts_with dir file is a substring check. It can return true even when the dirname of dir is a substring of the dirname of file.

# OpamFilename.starts_with (OpamFilename.Dir.of_string "/a/path") (OpamFilename.of_string "/a/path/to");;
- : bool = true
# OpamFilename.starts_with (OpamFilename.Dir.of_string "/a/path") (OpamFilename.of_string "/a/path-xxx/to");;
- : bool = true
# OpamFilename.starts_with (OpamFilename.Dir.of_string "/a/path/") (OpamFilename.of_string "/a/path-xxx/to");;
- : bool = true

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions