`Plot::show()` panics when no opener binary exists, and silently no-ops when it fails
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 62/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- rust
- Domaine
- data-visualization
Piste de recherche
Commencez dans plotly/src/plot.rs, au niveau de l’implémentation référencée de Plot::show(), et examinez les branches Linux, macOS et Windows, y compris les définitions d’erreurs vers les lignes 57-65. Reproduisez le cas Linux headless, puis vérifiez que les binaires opener manquants et les statuts opener non nuls sont signalés aux appelants au lieu de provoquer un panic ou d’être ignorés silencieusement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Rust
- Étoiles
- 1.5k
- Forks
- 130
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de plotly/plotly.rs
-
Surface::surface_color has the wrong type: it should be a 2D numeric array, not Vec<Box<dyn Color>>Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 62/100
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
-
Support Plotly Express color sequencesPeut-être pris @iynehz l’a pris il y a 41 jours. Ouverteenhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
Toutes les issues de plotly/plotly.rs
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
riverqueue/river#1576 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
stadelmanma/fitparse-rs#64 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
zed-extensions/java#325 ·
-
Suggestion: full-band strip — mark the tuned frequency in magenta, with triangles on the edgesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
dividebysandwich/sdroxide#769 ·
Les mainteneurs répondent en général sous 5 jours