-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix linker error #85953
Fix linker error #85953
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Actually, I just thought of one potential problem. I'm not sure if it's a problem, and if so how to fix it. This may cause the |
It's been pointed out to me on Zulip that I may want to change the way this works for Android. It's probably possible to use syscall to access |
@kennytm: This is now ready for you to review. I'm sorry it wasn't before. |
It doesn't look like kennytm has had a chance to review for a while (which is valid!), so asking for a review from someone else. I think I'm allowed to do that? I apologize if I'm not. r? @yaahc |
Just did a first pass review and left some comments in the related zulip thread. |
Status reportThe situation before this PRAt present, Before I move on, I want to call attention to the priority of this problem. #80804, the relevant issue, is How we got here
What this PR doesThis PR changes the implementation of Unresolved problem 1: nonstandard behavior on older macOSThis PR would mean that Option 1A: Allow the test to failThis option means that, when the Pros: This is a minimal change. The test still runs on newer macOS versions. If we were willing to let Option 1B: Don't run the test on macOSThis option means that the Pros: Tests always pass. Option 1C: Write a special version of the test for macOSWith a bit of work, we might be able to write a version of the Pros: Tests always pass. Unresolved problem 2: what to do with AndroidThis problem is minor: all the options work fine and the differences are marginal.
Option 2A: Don't change AndroidThis option suggests we continue using Pros: It isn't broken, so why fix it? This may have marginally better performance. Note: I'm in favor of this option. I would prefer to fix the problem on macOS and consider making to changes to Android out of scope for this PR. However, I am willing to do whatever the libs team wants me to do. Option 2B: Use
|
Is there any chance the If so, we need some reasonable way for the caller to make sure they use If not, just disabling that test on old macOS seems fine. |
@joshtriplett Technically, there could be a security problem if a file that the program expects to not be a link is replaced by a link and the function creates a hard link to the wrong file. However, I don't think this is really worth worrying about. The Actually, it looks like I need to update the platform specific behavior section of that documentation. I'll do that along with the test change. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@joshtriplett I have fixed the test as you suggested. To make it work, I needed to use I fixed the problem by making I would appreciate the opportunity to do an interactive rebase before final merging, since the commit history is currently an unholy mess. Still, I think this is ready for review. @rustbot label -I-needs-decision -S-waiting-on-team +S-waiting-on-review |
We discussed this in today's @rust-lang/libs meeting. We agreed to merge this change to provide interim support for older macOS versions: @bors r+ We also agreed that we should start the conversation about how much longer to support older macOS versions, following the process for the target tier policy. |
📌 Commit dac351ea8a010ed3bcddfb88a76dab4485b52927 has been approved by |
⌛ Testing commit 64b61ac10a6425710e2f337f37a79c891d3a0afb with merge c7a3413527a32bc7c9c7546c4e251a4c5246ceba... |
💥 Test timed out |
This comment has been minimized.
This comment has been minimized.
@bors retry |
@bors r- There's an utterly minor nit that's been bothering me, and if the tests need to be rerun anyway, this is as good a time as any to fix it. |
`weak!` is needed in a test in another module. With macros 1.0, importing `weak!` would require reordering module declarations in `std/src/lib.rs`, which is a bit too evil.
On old macos systems, `fs::hard_link()` will follow symlinks. This changes the test `symlink_hard_link` to exit early on these systems, so that tests can pass.
64b61ac
to
5999a5f
Compare
Okay, now that the imports in that one spot are alphabetized (look, it was really bothering me)... @bors r=joshtriplett |
📌 Commit 5999a5f has been approved by |
☀️ Test successful - checks-actions |
Hey @inquisitivecrystal, we discussed backporting this PR in the last Library team meeting and decided against it on the basis that this breakage occurred 6 months ago and hasn't seen many people complaining about it so we're assuming its relatively low impact. That plus the fact that devs can either pin to an old stable version or update to nightly to get a compiler that does work on the old macos platforms made us prefer to avoid even doing a risk analysis on the back port and just wait a few weeks until the fix hits stable again. If there are any issues that we missed please let me know and thank you again for the PR! |
@yaahc Thank you very much for considering my nomination! There are a few people eagerly waiting for this fix: some of them commented on #80804. It is true that there don't seem to be all that many people who need this though. I'd still personally do it, just on the basis that #80804 is a TL;DR: I'd backport, but I see why libs might not want to. If you don't feel that I'm bringing up anything that would change the team's mind, and it's sounding like I'm not, don't worry about it. I totally understand. Thank you again for all the support throughout the process. I've greatly enjoyed the experience of contributing to the standard library, and it has been fun enough that I'm going to keep doing it again in future. :) |
Currently,
fs::hard_link
determines whether platforms havelinkat
based on the OS, and useslink
if they don't. However, this heuristic does not work well if a platform provideslinkat
on newer versions but not on older ones. On old MacOS, this currently causes a linking error.This commit fixes
fs::hard_link
by telling it to useweak!
on macOS. This means that, on that operating system, we now check forlinkat
at runtime and uselink
if it is not available.Fixes #80804.
@rustbot label T-libs-impl