Thursday, January 23, 2025

[patch] security/vaultwarden: compat with rustc 1.84.0 (and newer)

Hi,

For lang/rust update to 1.84.0, I would need to backport the following
patch from upstream.

https://github.com/dani-garcia/vaultwarden/pull/5371

I didn't tested it with 1.83.0, as I intent to commit it only with
1.84.0 update (and the package will be bumped by the lang/rust update).

Comments or OK ?
--
Sebastien Marie



Commit ID: e2525aa00c16d720f7bb6e30a3aaeb52f2ad3006
Change ID: tzznouvkvpmsuunuznstmmlkzvlotrwz
Author : Sebastien Marie <semarie@kapouay.eu.org> (2025-01-21 14:17:02)
Committer: Sebastien Marie <semarie@kapouay.eu.org> (2025-01-24 06:45:54)

security/vaultwarden: patch for lang/rust 1.84.0

diff --git a/security/vaultwarden/patches/patch-Cargo_toml b/security/vaultwarden/patches/patch-Cargo_toml
index d6b86f3be6..bc19b50ee2 100644
--- a/security/vaultwarden/patches/patch-Cargo_toml
+++ b/security/vaultwarden/patches/patch-Cargo_toml
@@ -1,3 +1,5 @@
+Allow building with Rust v1.84.0 or newer (#5371)
+
Index: Cargo.toml
--- Cargo.toml.orig
+++ Cargo.toml
@@ -10,3 +12,14 @@

# Strip debuginfo from the release builds
# The symbols are the provide better panic traces
+@@ -230,6 +230,10 @@ unused_import_braces = "deny"
+ unused_lifetimes = "deny"
+ unused_qualifications = "deny"
+ variant_size_differences = "deny"
++# Allow the following lints since these cause issues with Rust v1.84.0 or newer
++# Building Vaultwarden with Rust v1.85.0 and edition 2024 also works without issues
++if_let_rescope = "allow"
++tail_expr_drop_order = "allow"
+
+ # https://rust-lang.github.io/rust-clippy/stable/index.html
+ [lints.clippy]
diff --git a/security/vaultwarden/patches/patch-src_api_notifications_rs b/security/vaultwarden/patches/patch-src_api_notifications_rs
new file mode 100644
index 0000000000..aa41c8e63d
--- /dev/null
+++ b/security/vaultwarden/patches/patch-src_api_notifications_rs
@@ -0,0 +1,30 @@
+Allow building with Rust v1.84.0 or newer (#5371)
+
+Index: src/api/notifications.rs
+--- src/api/notifications.rs.orig
++++ src/api/notifications.rs
+@@ -101,6 +101,7 @@ impl Drop for WSAnonymousEntryMapGuard {
+ }
+ }
+
++#[allow(tail_expr_drop_order)]
+ #[get("/hub?<data..>")]
+ fn websockets_hub<'r>(
+ ws: WebSocket,
+@@ -186,6 +187,7 @@ fn websockets_hub<'r>(
+ })
+ }
+
++#[allow(tail_expr_drop_order)]
+ #[get("/anonymous-hub?<token..>")]
+ fn anonymous_websockets_hub<'r>(ws: WebSocket, token: String, ip: ClientIp) -> Result<rocket_ws::Stream!['r], Error> {
+ let addr = ip.ip;
+@@ -290,7 +292,7 @@ fn serialize(val: Value) -> Vec<u8> {
+ fn serialize_date(date: NaiveDateTime) -> Value {
+ let seconds: i64 = date.and_utc().timestamp();
+ let nanos: i64 = date.and_utc().timestamp_subsec_nanos().into();
+- let timestamp = nanos << 34 | seconds;
++ let timestamp = (nanos << 34) | seconds;
+
+ let bs = timestamp.to_be_bytes();
+

No comments:

Post a Comment