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

Unclear what "ExtraneousLocale" error means #4165

Closed
sophie-h opened this issue Oct 16, 2023 · 6 comments · Fixed by #4166
Closed

Unclear what "ExtraneousLocale" error means #4165

sophie-h opened this issue Oct 16, 2023 · 6 comments · Fixed by #4166
Labels
C-collator Component: Collation, normalization T-bug Type: Bad behavior, security, privacy

Comments

@sophie-h
Copy link

My collator works with all languages but vi:

Collator::try_new_with_buffer_provider(&provider, &icu_locid::locale!("vi").into(), CollatorOptions::new())

I get the following message

Data(DataError { kind: ExtraneousLocale, key: Some(DataKey{collator/dia@1}), str_context: None, silent: false })

I can't figure out what this error means. Since it's an provider error, is it an error in the data?

I got the data via DatagenProvider::new_latest_tested().

@sffc sffc added T-bug Type: Bad behavior, security, privacy C-collator Component: Collation, normalization labels Oct 16, 2023
@sffc
Copy link
Member

sffc commented Oct 16, 2023

Hmm, something's wrong here.

ExtraneousLocale is an error to signify a singleton key that was loaded with something other than the root locale.

CollationDiacriticsV1Marker is labeled as a singleton key in 1.3:

#[icu_provider::data_struct(marker(
    CollationDiacriticsV1Marker,
    "collator/dia@1",
    extension_key = "co",
    fallback_by = "collation",
    fallback_supplement = "collation",
    singleton,
))]
// ...
pub struct CollationDiacriticsV1<'data>

but the rest of the configurations, as well as the way the key is loaded, suggest that it should not be singleton:

        let tailored_diacritics = metadata.tailored_diacritics();
        let diacritics: DataPayload<CollationDiacriticsV1Marker> = provider
            .load(if tailored_diacritics {
                req
            } else {
                Default::default()
            })?
            .take_payload()?;

Is it wrong that it is labeled as a singleton key?

@hsivonen @robertbastian

@sffc sffc added the needs-approval One or more stakeholders need to approve proposal label Oct 16, 2023
@sffc
Copy link
Member

sffc commented Oct 16, 2023

We should add a test that singleton keys don't have data in datagen that is non-singleton.

@sffc
Copy link
Member

sffc commented Oct 17, 2023

Filed two follow-up issues for holes in our testing infrastructure that let something like this leak through.

I also suspect that the upcoming Unicode Conformance test could have caught this since it has broader locale coverage.

@sffc
Copy link
Member

sffc commented Oct 17, 2023

I double-checked the other collator keys labaled as singleton and verified that they are correctly being loaded as singleton, so this problem is isolated only to the "collator/dia@1" data key.

@sffc
Copy link
Member

sffc commented Oct 18, 2023

@sophie-h
Copy link
Author

Thanks a lot!

@sffc sffc removed the needs-approval One or more stakeholders need to approve proposal label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-collator Component: Collation, normalization T-bug Type: Bad behavior, security, privacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants