dialog silently fails if terminfo is unavailable
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dialog (Ubuntu) |
New
|
Undecided
|
Unassigned | ||
pythondialog (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When using dialog python package to present a yesno dialog, it silently fails if the user has a locally installed terminfo and the terminfo is unavailable (for example because the dialog is presented from a script launch via sudo).
To reproduce, you'll need those two files:
1. xterm-screen-256 available at https:/
2. present-dialog.py inlined here:
$ cat present-dialog.py
import dialog
d = dialog.Dialog()
r = d.yesno("Please select Yes!", backtitle="title", width=65, defaultno=True)
assert r == d.DIALOG_OK
Steps to reproduce:
1. install the xterm-screen-
2. export TERM=xterm-
3. run the script as your user and see that the dialog is presented
4. run the script with sudo python present-dialog.py and see that the assert fails and the dialog is not presented
Expected result:
The dialog library should print an error if the dialog cannot be presented because the terminfo is not available (since it is only installed for the current user not for root) or fallback to a dumb terminfo if possible (ie. no dialog just printing the text and offering a yes/no prompt).
Contrary to my initial thought, it seems this should actually get assigned to pythondialog.
Running the present-dialog.py quoted above, I can reproduce.
Running this commandline (which should be what python-dialog is calling), I can't reproduce. Well, I can reproduce the failure, but also get a useful error message:
$ sudo dialog --yesno "Please check Yes!" 0 65 --backtitle "title" 256color.
Error opening terminal: xterm-screen-
Call without sudo shows the expected dialog.