-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make .cargo/config
deprecation warnings silent
#13667
Comments
I would suggest not to check Cargo's stderr, as it is generally for human and subject to change at any time. That being said, #12235 is a way out, and we've landed the initial version of the linting system in #13621.
Personally I wouldn't add more complexity to the logic there until we have a lint for it. I don't speak for others. |
.cargo/config
deprecation warnings silent
It seems to me that the current situation is simply wrong. cargo prints a warning, and suggests a resolution, but then it also prints a warning about the suggested resolution. cargo should not suggest a resolution that isn't effective. If there is another resolution for this situation, cargo should suggest that. I also don't think #12235 is going to be the answer because it's a year old and obviously isn't going to happen soon. The current situation is a regression.
That's all very well, but I need to test the stderr output of a proc macro, which can't realistically be done without invoking cargo and rustc. If I don't get a better resolution I guess I'm going to be writing horrible code to filter out this nuisance warning with regexps, or something. I would very much like to avoid that. |
I went to fix this. UTSL, and I find
which is buggy. I will fix it. |
This is 100% reliable on Unix, and better on Windows. (In this commit I avoid reindenting things to make review easier; the formatting will be fixed in the next commit.) Fixes rust-lang#13667
This is 100% reliable on Unix, and better on Windows. (In this commit I avoid reindenting things to make review easier; the formatting will be fixed in the next commit.) Fixes rust-lang#13667
This is 100% reliable on Unix, and better on Windows. (In this commit I avoid reindenting things to make review easier; the formatting will be fixed in the next commit.) Fixes rust-lang#13667
Fix warning suppression for config.toml vs config compat symlinks ### What does this PR try to resolve? Background: the cargo config file is being renamed from `.cargo/config` to `.cargo/config.toml`. There's code in new cargo to look for both files (for compatibility), to issue a warning when onliy the old filename is found, and also to issue a warning if both files are found. The warning suggests making a symlink if compatibility with old cargo is wanted. An attempt was made to detect when both the old and new files exists, but one is a symlink to the other, but as reported in #13667, this code is not effective. (It would work only if the symlink had the precise absolute pathname that cargo has decided to use for the lookup, which would be an unnatural way to make the link.) Logically, the warning should appear when both files exist *but are different*. That is the anomalous situation that will generate confusing behaviour. By "different" we ought to mean "aren't the very same file". That's what this MR implements, where possible. On Unix, we use the information from stat(2). That's not available on other platforms; on those, we arrange to also tolerate a symlink referring to precisely `config.toml` as a relative pathname, which is also fine, since by definition the target is then in the same directrory as `config`. Fixes #13667. ### How should we test and review this PR? I have interleaved the new tests with the commits that support them. In each case, a functional commit is followed by a test which fails just beforehand. (This can be observed by experimentally reordering the branch.) I have also done ad-hoc testing. ### Additional information I'm making the assumption that a symlink containing a relative path does something sane on Windows. This assumption may be unwarranted. If so, "Handle `config` -> `config.toml` (without full path)" needs to be dropped, and the test case needs to be `#[cfg(unix)]`. But also, in this case, we should probably put some warnings in the stdlib docs!
Fix warning suppression for config.toml vs config compat symlinks ### What does this PR try to resolve? Background: the cargo config file is being renamed from `.cargo/config` to `.cargo/config.toml`. There's code in new cargo to look for both files (for compatibility), to issue a warning when onliy the old filename is found, and also to issue a warning if both files are found. The warning suggests making a symlink if compatibility with old cargo is wanted. An attempt was made to detect when both the old and new files exists, but one is a symlink to the other, but as reported in #13667, this code is not effective. (It would work only if the symlink had the precise absolute pathname that cargo has decided to use for the lookup, which would be an unnatural way to make the link.) Logically, the warning should appear when both files exist *but are different*. That is the anomalous situation that will generate confusing behaviour. By "different" we ought to mean "aren't the very same file". That's what this MR implements, where possible. On Unix, we use the information from stat(2). That's not available on other platforms; on those, we arrange to also tolerate a symlink referring to precisely `config.toml` as a relative pathname, which is also fine, since by definition the target is then in the same directrory as `config`. Fixes #13667. ### How should we test and review this PR? I have interleaved the new tests with the commits that support them. In each case, a functional commit is followed by a test which fails just beforehand. (This can be observed by experimentally reordering the branch.) I have also done ad-hoc testing. ### Additional information I'm making the assumption that a symlink containing a relative path does something sane on Windows. This assumption may be unwarranted. If so, "Handle `config` -> `config.toml` (without full path)" needs to be dropped, and the test case needs to be `#[cfg(unix)]`. But also, in this case, we should probably put some warnings in the stdlib docs!
I solved this problem by renaming |
thanks |
Problem
I want to be able to run cargo 1.31 and have it respect my
,.cargo/config
.There seems to be no way to achieve this without causing recent cargo to issue a warning.
Steps
config
is a file,config.toml
doesn't exist(Note that the phrase "symlink X to Y" is ambiguous. Does it mean make X a symlink to Y, or vice versa?)
config
is a file;config.toml
is a symlink to itconfig.toml
is a file,config
is a symlink to itPossible Solution(s)
Check to see if one of the files is a link to the other. If so, don't issue the warning about both files existing.
The "one file is a link to the other" check should be done with
stat
and comparingst_dev
andst_ino
. (AIUI Windows doesn't have symlinks in the same way so we don't need to do this check there.)Notes
This is a blocker for me upgrading the pinned nightly used by CI tests for derive-deftly, because I have UI tests that check for the precise stderr output. Right now, those tests always produce polluted output in my local environment.
This is happening to me with
+nightly-2024-03-14
. I can't easily try a more recent version because my rustup is completely broken due to rust-lang/rustup#3737Version
The text was updated successfully, but these errors were encountered: