dialog silently fails if terminfo is unavailable

Bug #1350319 reported by Sylvain Defresne
6
This bug affects 1 person
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://gist.github.com/leomao/9866009
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-256color terminfo using tic xterm-screen-256color
2. export TERM=xterm-screen-256color
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).

Revision history for this message
Sven Mueller (smu-u) wrote :

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"
Error opening terminal: xterm-screen-256color.

Call without sudo shows the expected dialog.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.