-
Notifications
You must be signed in to change notification settings - Fork 161
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 canonical and read_symlink for junction points #100
Conversation
8ebc8cb
to
4ccd0b4
Compare
Test was verified to trigger the bug: https://ci.appveyor.com/project/pdimov/filesystem/builds/22102228/job/0k3ueppx1l562jm5 |
There is a test failure remaining on MinGW resulting from a to low or missing define for |
Boost doesn't drop Windows versions, it's Windows SDKs that may drop some Windows versions. Legacy MinGW is pretty conservative, it appears to have stopped evolving before it had any reasonable support for NT6 APIs, so XP is a good choice for that target. With regard to Boost.Filesystem, I'm not sure there is any NT6 API used in the library, so it may make sense to target XP on any Windows SDK. |
@Flamefire I added tests for my pull request #102. |
Is this PR related to issues and patches submitted here? |
@mloskot It seems it adresses the same issue. Can't really compare the patches though. If this change is wanted, I can rebase |
How do I find out if this has been released and in which version? |
3d6443d
to
a7a199b
Compare
@mloskot @pdimov Requesting review of this PR. Rebased to current develop after the latest changes (indentation and such) caused major conflicts. Not sure why it has been pending for so long given that on Windows a wrong struct is read which could be a security vulnerability. But also forgot about this before the 1.73 release |
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.
@Flamefire I did skim the changes, but I'm not an expert of filesystem API. If your test passes, then I take it as all is good.
One nitpick thought, perhaps the test should be disabled on non-Windows completely with something like this <target-os>unix,<build>no
a7a199b
to
602476b
Compare
@mloskot Thanks, that's a good idea. Wasn't that familiar with B2 back then. And syntax of it is hard too, needed a colon, not comma ;-) |
Also fixed a failed conflict resolution. Should be good now. Let's see what CI says. I'm no expert of this either but I'm confident in the changes. Especially as it now doesn't blindly reinterpret_cast a pointer but checks the "enum" first and fails for unknown values. |
Right, I forgot the |
c3e541a
to
1a7a5d2
Compare
c9c0b7d
to
6c4768a
Compare
6c4768a
to
b56b141
Compare
Resolving junction points in read_symlink and canonical is wrong
Read the correct struct member depending on the tag
// This failed before due to broken handling of absolute paths and ignored ReparseTag | ||
int main() | ||
{ | ||
if (std::system("mklink /?") != 0) |
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.
This check doesn't work on Windows 8.1. mklink
exists, it prints help, and then the test decides it doesn't exist and exits.
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.
Hm, any other idea? I have no clue why this would return non-zero
Last resort would be to check the below std::system("mklink /j junction real")
directly but if that fails due to a bug in the code it will skip everything too.
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 don't know why std::system
returns 1, but it does. It also returns 1 if the file doesn't exist. I think std::system
result is not indicative and not trustworthy, we need to find another way. Possibly, from the Jamfile.
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.
Maybe try running it and check if the link got created. Only skip if it wasn't.
Also the test should include mklink /D ...
The failures were different with that type of link. And there could be differences whether it's an absolute or relative link to absolute or relative path.
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've already implemented a different check in the Jamfile.
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.
Another problem with this test is that it doesn't remove the temporary directory it creates. remove_all
fails at removing "<temp_dir>/real/sub" with error 32 (directory used by another process).
Resolving junction points in read_symlink and canonical is wrong making it unusable: It silently returns the wrong results.
Issues identified:
C:
and refers to the current working directory on C. Hence depending if the current dir is a symlink canonical resolves the root_name to the current dir which is wrongSupersedes #45