-
Notifications
You must be signed in to change notification settings - Fork 816
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 Crash on permission failure #2906
Conversation
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.
Can you elaborate on where this "permission failure" is coming from?
Will this fix #2823 (comment)? |
Very likely. I still don't know when and why this happens. For me, it seems like a permission failure. But the error message (unsupported operation) was not very specific, and it occurred in 90% of all cases. So I just decided to use a similar approach which is a lot more safe, but a bit more expensive. Since it is not in a loop, this is fine. |
@Febbe maybe it has to do with SIP protection? https://support.apple.com/en-us/HT204899 |
We actually use that library for file system handling on Mac, Edit: we are using the ghc::filesystem version that supposedly includes the fix for the linked issue. |
There is also a defect report in the documentation to that: https://cplusplus.github.io/LWG/issue2937 |
I can confirm that with the change to #include <iostream>
#include <cstdint>
#include <filesystem>
#include <cassert>
namespace fs = std::filesystem;
int main(int argc, char* argv[])
{
assert(argc >= 3);
// hard link equivalency
fs::path p1 = argv[1];
fs::path p2 = argv[2];
// if (fs::equivalent(p1, p2)) {
if (fs::weakly_canonical(p1) == fs::weakly_canonical(p2)) {
std::cout << p1 << " is equivalent to " << p2 << '\n';
return 1;
} else {
std::cout << p1 << " is NOT equivalent to " << p2 << '\n';
return 0;
}
} |
- replaced fs::equivalent with 2 more robust calls to weakly_canonical - catched an error on failure.
5aa312a
to
c643db5
Compare
fs::equivalent
with 2 more robust calls tofs::weakly_canonical