Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ortham opened this issue Sep 11, 2019 · 0 comments
Open

Comments

@Ortham
Copy link
Member

Ortham commented Sep 11, 2019

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant