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

Unsetting AllowInvalidUtf8 does nothing #2613

Closed
2 tasks done
epage opened this issue Jul 21, 2021 · 3 comments · Fixed by #2677
Closed
2 tasks done

Unsetting AllowInvalidUtf8 does nothing #2613

epage opened this issue Jul 21, 2021 · 3 comments · Fixed by #2677
Labels
C-bug Category: Updating dependencies
Milestone

Comments

@epage
Copy link
Member

epage commented Jul 21, 2021

Please complete the following tasks

  • I have searched the discussions
  • I have searched the existing issues

Rust Version

rustc 1.53.0 (53cb7b09b 2021-06-17)

Clap Version

3.0.0-beta.2

Minimal reproducible code

app.unset_settings(AppSettings::AllowInvalidUtf8)

Steps to reproduce the bug with the above code

Pass in invalid UTF-8

Actual Behaviour

Its allowed

Expected Behaviour

Its rejected

Additional Context

I actually found this by inspection.

$ rg AllowInvalidUtf8
tests/app_settings.rs
598:    assert!(&m.is_set(AppSettings::AllowInvalidUtf8));
602:        .unset_global_setting(AppSettings::AllowInvalidUtf8)
604:    assert!(!m.is_set(AppSettings::AllowInvalidUtf8), "{:#?}", m);

src/build/app/settings.rs
83:    AllowInvalidUtf8("allowinvalidutf8")
197:    ///   //.setting(AppSettings::AllowInvalidUtf8)
215:    AllowInvalidUtf8,
1151:            AppSettings::AllowInvalidUtf8

And in AppSettings

    // TODO: Either this or StrictUtf8
    AllowInvalidUtf8,

Debug Output

No response

@epage epage added the C-bug Category: Updating dependencies label Jul 21, 2021
@hosseind88
Copy link
Contributor

can anyone explain to me please what should I do to fix this issue?
I checked code but I don't understand what we should change about TODO

@epage
Copy link
Member Author

epage commented Jul 22, 2021

I believe AllowInvalidUtf8 was being renamed to StrictUtf8 but the old name was left in. The name should probably be removed and people use StrictUtf8.

This needs to get added to the changelog to help people when upgrading from clap2 to clap3

@hosseind88
Copy link
Contributor

thanks, I have submitted the PR

@pksunkara pksunkara added this to the 3.0 milestone Aug 2, 2021
@pksunkara pksunkara linked a pull request Aug 10, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
3 participants