| Summary: | devel/cdialog timeouts not working | ||
|---|---|---|---|
| Product: | Ports & Packages | Reporter: | nkoch |
| Component: | Individual Port(s) | Assignee: | Mateusz Piotrowski <0mp> |
| Status: | Closed Not A Bug | ||
| Severity: | Affects Many People | CC: | 0mp, jcpierri |
| Priority: | --- | Flags: | jcpierri:
maintainer-feedback+
|
| Version: | Latest | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
nkoch
2020-11-10 09:34:16 UTC
"DIALOG_ESC=1 DIALOG_ERROR=3 cdialog --timeout 2 --yesno Start? 0 0 ; echo $?" returns 1 on timeout on my machine as well. It looks like a problem which should be reported upstream. Tested on FreeBSD 13.0 with cdialog-1.3.20200327,2. I downloaded the current source tarball from invisible-island.net and compiled it under Ubuntu 20.04 LTS, just to be sure that it was nothing FreeBSD related, and confirmed that this behaviour also happens on Ubuntu too. I made an additional test using an old Slackware Linux that had dialog 1.2-20130523 and it behaved as expected, with (3) returned on timeouts. I submitted a bug report to Thomas Dickey, author and maintainer of dialog. I found this in cdialog's changelog for version 2018/06/21: + modify dlg_getc() to return ESC when a timeout expires, notifying callers that a quit occurred rather than exiting the application (suggested by Rodrigo Freitas). ( https://invisible-island.net/dialog/CHANGES ) (In reply to nkoch from comment #3) Thomas Dickey confirmed that this change was intentional. Undoing the change would be trivial:
diff --git a/dialog-1.3-20200327/ui_getc.c b/dialog-1.3-20200327/ui_getc.c
--- a/dialog-1.3-20200327/ui_getc.c
+++ b/dialog-1.3-20200327/ui_getc.c
@@ -486,9 +486,7 @@ dlg_getc(WINDOW *win, int *fkey)
case ERR: /* wtimeout() in effect; check for file I/O */
if (interval > 0
&& current >= expired) {
- DLG_TRACE(("# dlg_getc: timeout expired\n"));
- ch = ESC;
- done = TRUE;
+ dlg_exiterr("timeout");
} else if (!valid_file(stdin)
|| !valid_file(dialog_state.screen_output)) {
DLG_TRACE(("# dlg_getc: input or output is invalid\n"));
But perhaps it would be better to make this an option.
I am not sure if it is a good idea to keep this patch as an option in the ports tree. It sounds like it would be much better if the patch was integrated into upstream. Perhaps Thomas Dickey would like to offer your desired behavior as, e.g., a build-time option. I'll leave the decision to the maintainer, however. I sent this suggestion (to create an option that reverts to the old behaviour) to Thomas, however, as this change was intentional, I agree with Mateusz that it is up to him to say if that makes sense or not. This seems like a feature change, not a bug. I'll close this PR for now. Please feel free to reopen it if there is something to be done on our part. Thanks! |