`Plot::show()` panics when no opener binary exists, and silently no-ops when it fails
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu trong plotly/src/plot.rs, tại phần triển khai Plot::show() được tham chiếu, và kiểm tra các nhánh Linux, macOS và Windows, bao gồm cả các định nghĩa lỗi gần dòng 57-65. Tái hiện trường hợp Linux headless, sau đó xác minh rằng các binary opener bị thiếu và các trạng thái opener khác không được báo cáo cho bên gọi thay vì gây ra panic hoặc bị âm thầm bỏ qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Plot::show() offers no way for a caller to handle a failed browser handoff.
Running it on a headless server causes a panic, but the panic message is misleading.
How to reproduce
use plotly::{Plot, Scatter};
fn main() {
let mut plot = Plot::new();
plot.add_trace(Scatter::new(vec![0, 1, 2], vec![0.0, 1.5, 3.0]));
plot.show();
}
Run on a headless Linux host with no xdg-open on PATH 👍
thread 'main' panicked at .../plotly-0.14.1/src/plot.rs:789:14:
Could not find default application for HTML files.
[...]
: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Environment
- plotly 0.14.1
- rustc 1.98.0
- AlmaLinux 9.8
Expected
A library call should not abort the process over a missing external binary. The caller should have
some way to detect this and potentially fall back to write_html() or write_image() on its own or
show a clear error message.
Cause
There are two problems with it:
-
Missing binary panics:
.output()returnsErronly when the process cannot be
spawned, i.e.xdg-openis not onPATH..expect()turns that into a panic, and
show()returns(), so a caller has nothing to match on.
The resulting error message is very misleading here: https://github.com/plotly/plotly.rs/blob/00fe0512e9f924bd0fc2edfc6cc617a1604f4e0d/plotly/src/plot.rs#L57-L65 -
Return code of the xdg-open is ignored: If
xdg-openis installed but exits non-zero
(e.g. when no application is registered for HTML) it still returnsOk, carrying
the failure insideOutput::status, but status is never read.
- Ngôn ngữ chính
- Rust
- Star
- 1.5k
- Fork
- 128
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 plotly/plotly.rs
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Tất cả issue của plotly/plotly.rs
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100