-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use FILE_ATTRIBUTE_TAG_INFO
to get reparse tag
#101260
Conversation
This avoid unnecessarily getting the full reparse data when all we need is the tag.
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.
Ah, great!
self.handle.as_raw_handle(), | ||
c::FileAttributeTagInfo, | ||
ptr::addr_of_mut!(attr_tag).cast(), | ||
mem::size_of::<c::FILE_ATTRIBUTE_TAG_INFO>().try_into().unwrap(), |
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.
Kind of goofy to do this here, but I guess I'm not opposed since the unwrap should vanish and I would generally like us to be more careful about a usize->dword.
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 was thinking of our conversation here and noticed it codegened fine. But it is weird. I do think it'd ultimately be better to have a proper wrapper for these cases that can statically assert the size fits into a u32. And also something for the cases that could possibly fail.
@bors r+ |
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct. r? `@thomcc` since you've made changes here recently (which is why I have this code on my mind atm)
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct. r? ``@thomcc`` since you've made changes here recently (which is why I have this code on my mind atm)
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct. r? ```@thomcc``` since you've made changes here recently (which is why I have this code on my mind atm)
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct. r? ````@thomcc```` since you've made changes here recently (which is why I have this code on my mind atm)
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct. r? `````@thomcc````` since you've made changes here recently (which is why I have this code on my mind atm)
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct. r? ``````@thomcc`````` since you've made changes here recently (which is why I have this code on my mind atm)
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#100121 (Try normalizing types without RevealAll in ParamEnv in MIR validation) - rust-lang#100200 (Change implementation of `-Z gcc-ld` and `lld-wrapper` again) - rust-lang#100814 ( Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1) - rust-lang#101215 (Also replace the version placeholder in rustc_attr) - rust-lang#101260 (Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag) - rust-lang#101323 (Remove unused .toggle-label CSS rule) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Is it possible that this caused #101344 ? |
I admit I'm struggling to see how it would be. |
Given that its an ICE which contains:
it seems like this did cause the issue, since compiling this code seems to have unearthed a latent compiler bug which results in this ICE. Unless the code is actually wrong I don't think we want to back it out, but if it's impossible to fix in rustc and is a huge issue for miri I suppose we could tweak it or keep the old version behind |
For sure, I'm not at all saying this didn't trigger a bug. But, as far as I can tell (tho I may be mistaken), this isn't the root cause. And it feels a bit unsatisfactory to fix a symptom and not the root cause. Although I guess a temporary workaround is fine (so long as it is actually temporary). Also, yeah, I'd really love to avoid |
I agree that this can't be the bug that causes the ICE, it just uncovers an existing bug, but also I have no way of even debugging the Miri fault (it only happens on Windows on CI), so until someone else figures that out Miri is stuck.
|
I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag.
GetFileInformationByHandleEx
can do exactly that by filling aFILE_ATTRIBUTE_TAG_INFO
struct.r? @thomcc since you've made changes here recently (which is why I have this code on my mind atm)