Your message dated Sat, 08 Jun 2024 22:38:19 +0000
with message-id <[email protected]>
and subject line Bug#1069047: fixed in rust-bindgen 0.66.1-6
has caused the Debian Bug report #1069047,
regarding librust-bindgen-dev: Thread 'main' panicked at 'called
Result::unwrap() on an Err value
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
1069047: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069047
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: librust-bindgen-dev
Version: 0.66.1-4
Severity: normal
Tags: patch upstream
X-Debbugs-Cc: [email protected]
Dear Maintainer,
While building the linux kernel with additional patches to enable support for
Apple Silicon, I came across a Rust panic due to the way bindgen v0.66
generates bindings. The error message I got was
> Thread 'main' panicked at 'called Result::unwrap() on an Err value:
> FromBytesWithNulError { kind: InteriorNul(x) }
(where x is an integer I did not take note of). After a bit of digging I found
out this is a known regression introduced in v0.66 and fixed in v0.68, having
to do with how bindgen deals with strings that have null bytes inside them.
More detail can be found at
https://github.com/rust-lang/rust-bindgen/issues/2566 (issue) and
https://github.com/rust-lang/rust-bindgen/pull/2567 (resolution). Would it be
possible to upload a version of bindgen v0.66 with the patch backported from
v0.68, or, as an alternative, to upgrade to the latter? I checked that the
original patch applies cleanly to v0.66 as present in the Debian archive, e.g.
by streamlining it and modifying the path of the patched file like in
attachment.
Thank you,
NoisyCoil
*** /home/noisycoil/bindgen.patch
--- a/codegen/mod.rs
+++ b/codegen/mod.rs
@@ -714,18 +714,18 @@ impl CodeGenerator for Var {
let len = proc_macro2::Literal::usize_unsuffixed(
cstr_bytes.len(),
);
- let cstr = CStr::from_bytes_with_nul(&cstr_bytes).unwrap();
// TODO: Here we ignore the type we just made up, probably
// we should refactor how the variable type and ty ID work.
let array_ty = quote! { [u8; #len] };
let cstr_ty = quote! { ::#prefix::ffi::CStr };
- let bytes = proc_macro2::Literal::byte_string(
- cstr.to_bytes_with_nul(),
- );
+ let bytes = proc_macro2::Literal::byte_string(&cstr_bytes);
- if rust_features.const_cstr && options.generate_cstr {
+ if options.generate_cstr &&
+ rust_features.const_cstr &&
+ CStr::from_bytes_with_nul(&cstr_bytes).is_ok()
+ {
result.push(quote! {
#(#attrs)*
#[allow(unsafe_code)]
--- End Message ---
--- Begin Message ---
Source: rust-bindgen
Source-Version: 0.66.1-6
Done: NoisyCoil <[email protected]>
We believe that the bug you reported is fixed in the latest version of
rust-bindgen, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
NoisyCoil <[email protected]> (supplier of updated rust-bindgen package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Sat, 08 Jun 2024 23:56:07 +0200
Source: rust-bindgen
Architecture: source
Version: 0.66.1-6
Distribution: unstable
Urgency: medium
Maintainer: Debian Rust Maintainers
<[email protected]>
Changed-By: NoisyCoil <[email protected]>
Closes: 1069047
Changes:
rust-bindgen (0.66.1-6) unstable; urgency=medium
.
* d/patches: backport "codegen: Generate CStr only if possible" from v0.68.0
(Closes: #1069047)
Checksums-Sha1:
26be56e782365dfee97b182918ca2db66507016a 2593 rust-bindgen_0.66.1-6.dsc
1dc2c704cd1ef1370814436c762d2a6f544e9705 6204
rust-bindgen_0.66.1-6.debian.tar.xz
6c1f7629d66ae0faa3d1e92164261d5b4bd7214f 6369
rust-bindgen_0.66.1-6_source.buildinfo
Checksums-Sha256:
b8d537e31a7002f72b95fc88b3ec4822c105b6a1451319fa374f21283de36f74 2593
rust-bindgen_0.66.1-6.dsc
fe1e8c9a6341b64392b245fddf4f017bae9c0499d97716766ecc73e2767723cb 6204
rust-bindgen_0.66.1-6.debian.tar.xz
81af8ffedf11d55d479a71d46014eb1947a72c4f7d20a08156034a9a1645fed6 6369
rust-bindgen_0.66.1-6_source.buildinfo
Files:
00edbc71daa930079d98b112555b0290 2593 rust optional rust-bindgen_0.66.1-6.dsc
099b750d0ca0a526dfb5dd16ea38dac1 6204 rust optional
rust-bindgen_0.66.1-6.debian.tar.xz
a8954aeccd1dd511cede86e0ce225cb6 6369 rust optional
rust-bindgen_0.66.1-6_source.buildinfo
-----BEGIN PGP SIGNATURE-----
iHUEARYIAB0WIQQUWTv/Sl6/b+DpcW7svtu2B7myvgUCZmTUCgAKCRDsvtu2B7my
vqQZAQDVl99j4tU1OgMwT7d5iN7o4hFhIPvj9AYrWLn9Nf0BSAEA5GLmszDXYVpG
gstsebose2oXh/ceS7mRnT+dlXx1rA0=
=Bj4W
-----END PGP SIGNATURE-----
pgpTdSjYtagiC.pgp
Description: PGP signature
--- End Message ---