Skip to content

Condition caching does not handle path case insensitivity as Windows does #1

@Ortham

Description

@Ortham

The condition cache stores the results of Function evals, and Function equality handles paths case-insensitively using the unicase crate. However, unicase does not implement the same case folding behaviour as Windows (not surprising, the latter's rules are a mystery).

In practice, the only variation that I've come across is that Greek 'Ρ', 'ρ' and 'ϱ' are all considered equal by unicase, but Windows only considers the first two to be equal. Unicase does give the same results for Turkish İ, ı, I and i.

A failing test case that demonstrates this:

#[test]
fn function_eq_for_file_path_should_match_windows_path_case_insensitivity_rules() {
    assert_eq!(
        Function::FilePath("I\u{03a1}".into()),
        Function::FilePath("i\u{03c1}".into())
    );
    assert_ne!(
        Function::FilePath("\u{03f1}".into()),
        Function::FilePath("\u{03a1}".into())
    );
    assert_ne!(
        Function::FilePath("\u{0130}".into()),
        Function::FilePath("\u{0131}".into())
    );
    assert_ne!(
        Function::FilePath("\u{0130}".into()),
        Function::FilePath("i".into())
    );
    assert_ne!(
        Function::FilePath("\u{0130}".into()),
        Function::FilePath("I".into())
    );
    assert_ne!(
        Function::FilePath("\u{0131}".into()),
        Function::FilePath("i".into())
    );
    assert_ne!(
        Function::FilePath("\u{0131}".into()),
        Function::FilePath("I".into())
    );
}

Other case-sensitivity discrepancies are:

  • The State struct has an active plugins hashset that is populated and queried by lowercasing strings
  • The CRC cache and plugin versions cache are hashmaps with string keys that are lowercased
  • The condition cache hashes conditions by lowercasing their string arguments
  • Non-numeric release IDs are compared as lowercased strings, rather than using Unicase's case folding (not filesystem-related)

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