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

cargo publish with cargo.toml on windows doesn't normalize the content #12384

Closed
epage opened this issue Jul 20, 2023 · 1 comment · Fixed by #12399
Closed

cargo publish with cargo.toml on windows doesn't normalize the content #12384

epage opened this issue Jul 20, 2023 · 1 comment · Fixed by #12399
Labels
C-bug Category: bug Command-publish S-triage Status: This issue is waiting on initial triage.

Comments

@epage
Copy link
Contributor

epage commented Jul 20, 2023

Problem

On case insensitive filesystems (which can include Windows and Mac), cargo allows cargo.toml to be used. When publishing, the case doesn't get normalize and we miss it when normalizing the content of the file (prepare_for_publish).

Once published

  • crates.io won't be able to process the file
  • the crate is unusable on systems with case-sensitive filesystems
  • behavior might be off or flat out broken without normalization (e.g. workspace inheritance)

Steps

$ cargo new foo
$ cd foo
$ cargo package --list --allow-dirty
Cargo.lock
Cargo.toml
Cargo.toml.orig
src/main.rs
$ move Cargo.toml t
$ move t cargo.toml
$ cargo package --list --allow-dirty
Cargo.lock
Cargo.toml
src/main.rs

Note the lack of Cargo.toml.orig

Possible Solution(s)

Long term, I'd prefer we error, suggesting a rename if cargo.toml exists

To help people transition, we should warn first.

Alternatively

  • we could normalize the file name
  • we could detect this and error when loading manifests

Notes

See also

Version

No response

@epage epage added C-bug Category: bug Command-publish S-triage Status: This issue is waiting on initial triage. labels Jul 20, 2023
@epage
Copy link
Contributor Author

epage commented Jul 24, 2023

Based on the zulip conversation, a generally accepted path forward would be to normalize on publish. Doing that does not preclude us from other solution alternatices in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-publish S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant