-
Notifications
You must be signed in to change notification settings - Fork 91
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
Rust dependency updates & Debian #202
Comments
A patch for this stuff would be appreciated. That bch_bindgen patch should not be pulled into Debian - the patch results in silent miscompilation, since rustc doesn't actually support packed and aligned structs - that needs to be fixed in rustc. |
Thanks for the quick response!
#203, #204, #205. I may or may not know what I'm doing, please review with care :)
Ah, I just read that issue more closely. That's unfortunate :/ Any ideas on how to workaround this? It'd be quite the hard sell to ship a fork of bindgen in Debian... |
This is the workaround - I realize it's not ideal for you guys, but it's a tricky situation and it needs to be addressed correctly. Here's the bug that needs to be addressed to handle this properly: rust-lang/rust#59154 (comment) |
Thanks, that's helpful! From the bug report you linked and associated ones, it doesn't seem there is consensus on whether this constitutes a problem or what a fix could look like... I'm concerned that by the time this gets fixed (if at all), rolled out in a new rustc version, then that new version making it to Debian etc., it's going to be a few years. It'd be nice to not get stuck with no mount.bcachefs in Debian for years to come, so I'm hoping for some other kind of workaround! Looking at the generated bindgen code, it looks like the difference is effectively just one occurence of: @@ -5924,7 +5924,6 @@
);
}
#[repr(C, packed(8))]
-#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone)]
pub struct bkey {
pub u64s: __u8, This may sound (very) dirty, but perhaps a way to address this would be for build.rs to postprocess the output with a |
I need a very new
|
So, to reiterate: simply stripping out the align() directive is incorrect, since it causes Rust and C to generate types with different sizes - the align means sizeof() will be rounded up to a multiple of the alignment. However - there is a workaround we could do in bindgen - bindgen could insert padding bytes when required. This won't be as good as actually getting support for #[repr(align)] and #[repr(packed)] into rustc, since with the align directive the compiler will know that some members won't be misaligned (or will be misaligned in more restricted ways), and can generate better code. But it is a workaround that wouldn't result in miscompiling code. |
With 7717a43 having been merged (thanks @bertschingert!), I think everything mentioned here has been resolved. Thanks everyone! |
bcachefs-tools in Debian disables the Rust parts, due to a few missing crates from Debian. I just reported this to the Debian maintainer (Debian #1060256), and looked a little bit into what it would take to bring this all to Debian. Most of the work is already done, and the bits remaining is on them, but perhaps you as upstream can help with a few parts?
parse-display
crate. As far as I can tell, that's not really used and is thus a spurious dependency? (This matters for Debian, because it's not currently packaged).The text was updated successfully, but these errors were encountered: