Closed cao closed 7 years ago
Thanks for the PR! I agree this is a problem and your patch is more-or-the-less the right way to solve it. However, C++17 is too bleeding edge. Could you rewrite your patch to use std::current_exception
and std::rethrow_exception
instead? See http://en.cppreference.com/w/cpp/error/exception_ptr
Done! Switched to current_exception
and rethrow_exception
instead.
Any news on possibly getting this merged? :-)
Ping? :-)
I am looking for this same feature.
Thank you @cao and very sorry about the delay.
If multiple GPG keys exist that could be used to decrypt the repository key, but GPG fails on one of them (e.g., the first one because it is stored on a SmartCard that is not plugged in), then no other keys are used to try to decrypt it, failing entirely instead of trying the additional GPG keys.
The code below is a quick fix on my part and is primarily meant to point to the bug. It depends on the optional feature that is part of C++17, but implemented in all major compilers already (tested with clang++ 3.8 and g++ 6.1.1). It is the canonical way to handle optional data (which a GPG error should be). Currently, it returns the last GPG error instead of the first or all of them. Returning the last error should be okay since the order in which keys are being returned by GPG does not appear to be sorted in any way.