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

Handle Windows-reserved paths consistently on all platforms #10461

Closed

Conversation

eholk
Copy link
Contributor

@eholk eholk commented Mar 4, 2022

Cargo had error handling and test coverage for the fact that path names such as aux.rs are not allowed on Windows. More recent versions of Windows do support such path names, but given that Cargo still supports older versions it would be better to have consistent handling of path names across all platforms. Indeed, there is already code to prevent packages containing reserved path names from being published, so it makes sense to be consistent elsewhere.

This commit changes the behavior to be consistent and tested on all platforms that Cargo supports.

This PR is a better way of doing what #10322 tried to do.

Cargo had error handling and test coverage for the fact that path names
such as `aux.rs` are not allowed on Windows. More recent versions of
Windows do support such path names, but given that Cargo still supports
older versions it would be better to have consistent handling of path
names across all platforms. Indeed, there is already code to prevent
packages containing reserved path names from being published, so it
makes sense to be consistent elsewhere.

This commit changes the behavior to be consistent and tested on all
platforms that Cargo supports.
@rust-highfive
Copy link

r? @alexcrichton

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 4, 2022
@joshtriplett joshtriplett added the T-cargo Team: Cargo label Mar 5, 2022
@joshtriplett
Copy link
Member

This looks reasonable to me.

It is, technically, a breaking change for non-Windows platforms, on which crates could otherwise work with such paths as long as they didn't publish to crates.io and didn't need to run on Windows.

So, let's see if we have consensus for this.

(The other reasonable alternative would be making this same change but keeping the cfg(windows), which would make it independent of Windows version but not apply the limitation to non-Windows platforms. I personally think, since we don't allow publishing crates with these paths, that we should go ahead and apply that restriction, at least until the future in which our minimum supported Windows version is Windows 11.)

@rfcbot merge

@rfcbot
Copy link
Collaborator

rfcbot commented Mar 5, 2022

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Mar 5, 2022
@weihanglo
Copy link
Member

Agree with this patch 👍🏾
But since it's a breaking change, do we need a transition period to warn the user of the potential break?

@ehuss
Copy link
Contributor

ehuss commented Mar 5, 2022

I don't think this is a change we should make. There are legitimate packages that contain these paths. This would be a breaking change for them. I don't think cargo should start to refuse supporting them on all platforms, as they work today on all non-windows platforms (and those authors may be perfectly content with that). I would prefer to keep the original behavior.

I'm not sure I follow how #10322 lead to this. I would be fine with testing if the current platform supports aux.rs as a filename to determine if that test should run or not. I'm not sure I understand the concern with that approach.

@eholk eholk changed the title Handle Windows-reserved paths on all platforms Handle Windows-reserved paths consistently on all platforms Mar 7, 2022
@joshtriplett
Copy link
Member

Per discussion on Zulip, I agree that it's alright to just test if the OS actually reserves these filenames, as long as the code used to test that is not the same implementation as the code used for that purpose when unpacking (which would be circular).

@rfcbot cancel

@rfcbot
Copy link
Collaborator

rfcbot commented Mar 7, 2022

@joshtriplett proposal cancelled.

@rfcbot rfcbot removed proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cargo Team: Cargo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants