Uh oh!
There was an error while loading. Please reload this page.
Check *all* errors in LLVMRustArchiveIterator* API - #38676
Conversation
rust-highfive
commented
Dec 29, 2016
(rust_highfive has picked a reviewer for you, use r? to override) |
hanna-kruppe
commented
Dec 29, 2016
cc @dylanmckay@shepmaster |
There was a problem hiding this comment.
I think this should be #if, right?
Also, if this branch is taken, that should free ret, right?
alexcrichton
commented
Dec 29, 2016
Could we perhaps tweak this to check errors at the appropriate time instead? That is, only advance the cursor on calls to |
hanna-kruppe
commented
Dec 29, 2016
We do only advance the cursor when calling |
alexcrichton
commented
Dec 29, 2016
Oh right yeah what I mean is that we only advance the internal iterator when we need to actually fetch the result of the advance. I think we could store some boolean flags or something like that to avoid skipping the first child, right? |
hanna-kruppe
commented
Dec 29, 2016
That would be pretty icky, but so is this hack. I'll give it a shot. |
9883a01 to
c99d716Comparehanna-kruppe
commented
Dec 29, 2016
@alexcrichton Updated. |
There was a problem hiding this comment.
I think this should happen first to prevent a segfault from calling next too much, right?
There was a problem hiding this comment.
Hm yeah, it should be above as well, but it's needed here, too (I got segfaults without it).
There was a problem hiding this comment.
Perhaps this could go in an else above with the check to ensure it always happens?
c99d716 to
f4f2b2eCompareIncrementing the `Archive::child_iterator` fetches and validates the next child. This can trigger an error, which we previously checked on the *next* call to `LLVMRustArchiveIteratorNext()`. This means we ignore the last error if we stop iterating halfway through. This is harmless (we don't access the child, after all) but LLVM 4.0 calls `abort()` if *any* error goes unchecked, even a success value. This means that basically any rustc invocation that opens an archive and searches through it would die. The solution implemented here is to change the order of operations, such that advancing the iterator and fetching the newly-validated iterator happens in the same `Next()` call. This keeps the error handling behavior as before but ensures all `Error`s get checked.
f4f2b2e to
8d50857Comparehanna-kruppe
commented
Dec 29, 2016
Updated. |
alexcrichton
commented
Dec 29, 2016
@bors: r+ Thanks! |
bors
commented
Dec 29, 2016
📌 Commit 8d50857 has been approved by |
…richton Check *all* errors in LLVMRustArchiveIterator* API Incrementing the `Archive::child_iterator` fetches and validates the next child. This can trigger an error, which we previously checked on the *next* call to `LLVMRustArchiveIteratorNext()`. This means we ignore the last error if we stop iterating halfway through. This is harmless (we don't access the child, after all) but LLVM 4.0 calls `abort()` if *any* error goes unchecked, even a success value. This means that basically any rustc invocation that opens an archive and searches through it would die. The solution implemented here is to change the order of operations, such that advancing the iterator and fetching the newly-validated iterator happens in the same `Next()` call. This keeps the error handling behavior as before but ensures all `Error`s get checked.
Incrementing the
Archive::child_iteratorfetches and validates the next child.This can trigger an error, which we previously checked on the next call to
LLVMRustArchiveIteratorNext().This means we ignore the last error if we stop iterating halfway through.
This is harmless (we don't access the child, after all) but LLVM 4.0 calls
abort()if any error goes unchecked, even a success value.This means that basically any rustc invocation that opens an archive and searches through it would die.
The solution implemented here is to change the order of operations, such that
advancing the iterator and fetching the newly-validated iterator happens in the same
Next()call.This keeps the error handling behavior as before but ensures all
Errors get checked.