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 warning when you try to publish a crate that contains files/folders with windows reserved filenames #8163

Closed
CPerezz opened this issue Apr 26, 2020 · 4 comments
Labels
C-bug Category: bug

Comments

@CPerezz
Copy link
Contributor

CPerezz commented Apr 26, 2020

Problem
Actually, you can create a lib or a bin where the package contains files such as aux.rs which have Windows reserved filenames.
As soon as #8055 is closed, cargo will display a proper error when you try to unpack these types of packages.

But it actually doesn't say anything to the user when you try to build/publish a crate.
Obviously, you maybe are not building your package to be ran in Windows but Linux, and then this is not an issue at all.

But maybe it should at least make the user know that if he is targeting Windows as an OS where the package is going to be deployed, using windows reserved filenames will make the package impossible to install or run.

Possible Solution(s)

  • Add a warning when you're trying to publish a crate with reserved filenames on any of it's files or folders. Nothing that prevents you to do this, but that explains that this can cause errors as the one that will be printed once Cargo should check for windows-reserved filenames when extracting a package. #8055 lands.
  • Imo it will be so annoying to have a warning on build level. Even something like #![allow(windows_reserved_filenames)] will do the job. But again, seems too much to me.

I don't know if that makes sense from the teams perspective, but the previous issue made me think that if we will error when we find that filenames, we should then advise users before publishing.

@CPerezz CPerezz added the C-bug Category: bug label Apr 26, 2020
@CPerezz CPerezz changed the title Cargo should warn/suggest you when you build or publish a crate have files with with windows reserved filenames Cargo warning when you try to publish a crate that contains files/folders with windows reserved filenames Apr 26, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 26, 2020

It should display a warning on all platforms like this:

warning: file src/aux.rs is a reserved Windows filename, it will not work on Windows platforms

Are you not seeing that on the latest nightly?

@CPerezz
Copy link
Contributor Author

CPerezz commented Apr 26, 2020

I'm not seeing it on the latest stable. I just tried, that's why I opened the issue.

Is there any reason why it is only triggered in nightly?

@ehuss
Copy link
Contributor

ehuss commented Apr 26, 2020

It was only implemented a few weeks ago in #7959. It takes anywhere from 6 to 12 weeks for changes to make it to stable. You can also check the CHANGELOG, which is updated once every 6 weeks.

@CPerezz
Copy link
Contributor Author

CPerezz commented Apr 26, 2020

Thanks @ehuss my bad, I should have reviewed it!

Sorry for the inconvenience then 😄

@CPerezz CPerezz closed this as completed Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants