Unix cache signals lose their structure argument and are rejected by AT-SPI
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #819 của @luccahuguet — đã merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- linux, rust
- Lĩnh vực
- desktop-dev
Hướng nghiên cứu
The bug is in the emit_cache_signal helper in adapters/unix/src/atspi/bus.rs, which passes the structure as the message body instead of wrapping it in a one-element tuple. The regression test from the issue, cache_signals_preserve_struct_arguments, needs a private bus, so run it with dbus-run-session -- cargo test --locked -p accesskit_unix ... -- --ignored. Done means the encoded SIGNATURE header matches the expected struct signatures. PR #819 already proposes this fix, so check it before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The Unix adapter emits AddAccessible and RemoveAccessible with flattened D-Bus signatures. Each signal should contain one structure argument, but the shared emit_cache_signal helper passes that structure directly as the message body.
Reproduced on upstream commit 466e24e252103f4d82bd6fbab98141b551e46e0c, using its unchanged lockfile: accesskit_unix 0.24.0, zbus 5.19.0, zvariant 5.15.0, and Rust 1.87.0 on x86_64 Linux.
| Signal | Expected wire signature | Observed wire signature |
|---|---|---|
| AddAccessible | ((so)(so)(so)iiassusau) |
(so)(so)(so)iiassusau |
| RemoveAccessible | (so) |
so |
GNOME AT-SPI 2.58.1 rejects the malformed AddAccessible signature; its RemoveAccessible handler likewise requires (so).
To reproduce, save the regression patch below as regression-only.patch and apply it to that upstream commit, then run:
dbus-run-session -- cargo test --locked -p accesskit_unix \
cache_signals_preserve_struct_arguments -- --ignored
The test calls the production helper on a private bus and checks the encoded D-Bus SIGNATURE header and round-tripped values. It fails with the original helper and passes after the two-line correction below. Inspecting only zbus's parsed signature can hide the missing structure boundary.
The proposed correction in PR #819 is to pass &(body,) to emit_signal, with the generic bound changed from DynamicType to Type so the tuple can be serialized. No dependency or lockfile changes are needed.
We also verified the backported correction in our Venus terminal client on native Wayland with Orca 49.4 and AT-SPI 2.58.1. Previously Orca retained stale focus and reported “No selected text” after returning from scrollback despite a valid selection. With the correction it reported the exact selected text é 界 without a focus-repair action. Those native checks used accesskit_unix 0.22.1, zbus 5.18.0, and zvariant 5.13.1; current upstream was verified at the wire level.
regression-only.patch (test only; production helper unchanged)
diff --git a/adapters/unix/src/atspi/bus.rs b/adapters/unix/src/atspi/bus.rs
index 3368185..ca9857d 100644
--- a/adapters/unix/src/atspi/bus.rs
+++ b/adapters/unix/src/atspi/bus.rs
@@ -523,3 +523,74 @@ where
Err(_) => Ok(default),
}
}
+
+#[cfg(all(test, not(feature = "tokio")))]
+mod tests {
+ use super::*;
+ use atspi::CacheItem;
+ use futures_lite::StreamExt;
+ use zbus::{MatchRule, MessageStream, message::Type};
+
+ fn assert_wire_signature(message: &zbus::Message, signature: &str) {
+ let bytes = message.data().bytes();
+ let length = bytes[12..16].try_into().unwrap();
+ let length = match bytes[0] {
+ b'l' => u32::from_le_bytes(length),
+ b'B' => u32::from_be_bytes(length),
+ _ => panic!("invalid D-Bus byte order"),
+ } as usize;
+ // Inspect the encoded header: zbus normalizes outer parentheses when reading it.
+ let mut field = vec![8, 1, b'g', 0, signature.len() as u8];
+ field.extend_from_slice(signature.as_bytes());
+ field.push(0);
+ assert!(
+ bytes[16..16 + length]
+ .windows(field.len())
+ .any(|w| w == field)
+ );
+ }
+
+ #[test]
+ #[ignore = "requires a private D-Bus session; run with dbus-run-session"]
+ fn cache_signals_preserve_struct_arguments() {
+ futures_lite::future::block_on(async {
+ let conn = Connection::session().await.unwrap();
+ let rule = MatchRule::builder()
+ .msg_type(Type::Signal)
+ .interface("org.a11y.atspi.Cache")
+ .unwrap()
+ .path(cache_path())
+ .unwrap()
+ .build();
+ let mut signals = MessageStream::for_match_rule(rule, &conn, Some(2))
+ .await
+ .unwrap();
+ let executor = Executor::new();
+ let bus = Bus {
+ conn: conn.clone(),
+ _task: executor.spawn(std::future::pending(), "unused"),
+ socket_proxy: SocketProxy::new(&conn).await.unwrap(),
+ desktop: Arc::new(OnceLock::new()),
+ };
+ let item = CacheItem::default();
+ bus.emit_cache_signal("AddAccessible", &item).await.unwrap();
+ let added = signals.next().await.unwrap().unwrap();
+ assert_eq!(added.header().member().unwrap().as_str(), "AddAccessible");
+ assert_wire_signature(&added, "((so)(so)(so)iiassusau)");
+ let (received,): (CacheItem,) = added.body().deserialize().unwrap();
+ assert_eq!(received, item);
+
+ bus.emit_cache_signal("RemoveAccessible", &item.object)
+ .await
+ .unwrap();
+ let removed = signals.next().await.unwrap().unwrap();
+ assert_eq!(
+ removed.header().member().unwrap().as_str(),
+ "RemoveAccessible"
+ );
+ assert_wire_signature(&removed, "(so)");
+ let (received,): (ObjectRefOwned,) = removed.body().deserialize().unwrap();
+ assert_eq!(received, item.object);
+ });
+ }
+}
- Ngôn ngữ chính
- Rust
- Star
- 1.5k
- Fork
- 122
- Merge trung bình
- 1 giờ 14 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AccessKit/accesskit
-
Document sub-treesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Document `Role::ColorWell`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Crash on macOS when the subclassing adapter is dropped while the view has key-value observersCó thể đã có người làm @RXNova đã nhận 4 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
AccessKit/accesskit#802 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của AccessKit/accesskit
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
area: compat area: parsing bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
reubeno/brush#1526 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Volume eject does not refuse system, root or /home mountsCó thể đã có người làm @bernardopg đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
spacedriveapp/spacedrive#3159 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100