-
Notifications
You must be signed in to change notification settings - Fork 126
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
[5.10] Android: add better nullability checks for nullability annotations added in NDK 26 (#444) #457
[5.10] Android: add better nullability checks for nullability annotations added in NDK 26 (#444) #457
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ class WalkTests : XCTestCase { | |
var expected: [AbsolutePath] = [ | ||
"\(root)/usr", | ||
"\(root)/bin", | ||
"\(root)/xbin" | ||
"\(root)/etc" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the test change for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this case years ago, back when some Android versions had this directory, matching |
||
] | ||
#else | ||
let root = "" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to not change this on 5.10, ie. force unwrap like in the other cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole point of adding a
guard let
here is that it's much safer and actually checks for the optional that the recent version of Bionic passes in. Why go back to a force unwrap then?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I kind of agree with keeping the guard-let here too. If it's about accepting risk, then a force-unwrap would be a worse outcome than an error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bar for 5.10 is extremely high at this point. If you'd like this change in, it needs to have zero impact outside of fixing the compilation errors. I'm all for the guard on main (and ideally, these would all be actually checks instead of force unwraps).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this passes that bar: the guard-let's are obviously fine, as they only make the code safer. The two remaining force unwraps: one is of a
baseAddress
access, which should never fail unless someone passes in a nil to that internal function intentionally, and the other is in a test support function.This patch was merged into the main branch a month ago and we've had zero problems with it: I think the same will be true on 5.10 and it will keep this toolchain compiling on linux with the newest versions of glibc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mixed up which thing this branch was targeting. Short of finding something like a security bug or memory issue like that, the changes can't have any impact on macOS at all. Even changing when something throws or aborts is more than what is acceptable for the 5.10 branch at this point. Sorry about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this passes that bar too, as these were all raw accesses on macOS before, so if they were going to fail, they would fail regardless. All we're changing on macOS is the way that fails, and I don't think that qualifies as "Even changing when something throws or aborts" as technically these all fail at exactly the same point on macOS after this patch, they just give better errors and fix compilation with glibc and bionic.