Re: bsdinstall TUI utility

From: Thomas Dickey <dickey_at_his.com>
Date: Sat, 28 May 2022 23:34:11 UTC
On Sat, May 28, 2022 at 04:02:51PM -0700, Devin Teske wrote:
> 
> 
> > On May 28, 2022, at 2:59 PM, Alfonso S. Siciliano <alfix86@gmail.com> wrote:
> > 
> > Hello,
> > 
> > 
> > So far I replaced and adapted `dialog` with `bsddialog` in
> > bsdinstall/scripts.
> > <https://wiki.freebsd.org/RoadmapFromDialogToBSDDialog>
> > 
> > 
> > Currently, I am addressing the last 4 scripts: auto, bootconfig, keymap,
> > and wlanconfig. These scripts use also the $DIALOG variable and some
> > "if" to handle Xdialog(1).
> > For example 'auto' uses $DIALOG, $USE_XDIALOG, and `dialog`.
> > 
> 
> Can we simply add USE_GNU_DIALOG and switch USE_DIALOG to mean bsddialog?

fwiw, dialog is LGPL.

It is not a GNU project.

Given the history of this feature, adding USE_BSDDIALOG would be less
disruptive.
 
> > * $DIALOG: I seem bsdinstall(8) uses only dialog(1) as TUI utility.
> 
> bsdinstall(8) uses only dialog(1) in the context of $DIALOG

by the way, the manpage doesn't list dialog in its "SEE ALSO".

(the existing oblique mention is a start)

> ASIDE: It also uses dialog(3) and dpv(3)/dpv(1)
> 
> 
> > * I seem bsdconfig(8) does not "call" these 4 scripts, so, probably,
> >  Xdialog(1) is not used in this context (that is `bsdconfig -X`).
> > 
> 
> Correct, bsdconfig does use bsdinstall
> 
> 
> > Is there any objection to delete $DIALOG/LGPL-dialog/Xdialog to
> > provide only the support for bsddialog(1) in bsdinstall(8)?
> > 
> 
> I object.

:-)
 
> I and another developer are adding support for zenity
> 
> https://github.com/FrauBSD/pkgcenter/tree/bsdconfig/zenity/depend/bsdconfig <https://github.com/FrauBSD/pkgcenter/tree/bsdconfig/zenity/depend/bsdconfig>
> 
> There is also work to resolve the namespace issues in bsdinstall
> 
> https://github.com/FrauBSD/pkgcenter/tree/bsdinstall/namespace/depend/bsdconfig <https://github.com/FrauBSD/pkgcenter/tree/bsdinstall/namespace/depend/bsdconfig>
> 
> I am in favor of keeping $DIALOG/LGPL-dialog/Xdialog support where it exists
> until those efforts can be completed.
> 
> ASIDE: bsdinstall doesn’t use Xdialog

iirc, Xdialog is defunct, except perhaps in ports.
 
> > I would prefer this solution because I can avoid: to handle some
> > dialog/Xdialog/bsddialog command line difference and to hook some
> > bsdconfig function built on dialog(1) incompatible with bsddialog(1)
> > (for example autosizing, implemented in bsddialog(3) already).
> > 
> 
> The differences in command line should be handled through conditionals, but can be the default and opt to handle LGPL-dialog through a USE_GNU_DIALOG flag
> 
> bsddialog may support auto-sizing, but so does dialog and Xdialog.
> 
> However, ...
> 
> The sizing code in bsdconfig (used indirectly by bsdinstall) was written
> because the auto-sizing that does exist and is available in both dialog and
> Xdialog (as well as Zenity) does not provide a cohesive experience when
> trying to write a program that is in-reality a series of bespoke dialogs.

Zenity's a graphical client, and isn't subject to the same limitations
that TUI clients encounter.
 
> The sizing code makes sure that regardless of which utility you are using
> that the experience is uniform in what is presented to the user.
> 
> Attempting to rely solely on the auto-sizing available from these separate
> utilities (including bsddialog) would change the UI/UX.
> 
> The problem was solved by:
> 
> 1. Making the stored text used for dialogs dictate how it will look
> 2. Painstakingly determining where each utility failed given the text
> 3. Determining how to make the utility display the text properly
> 
> For example, stored text will contain newlines instead of attempting to rely
> on line wrapping on a box of given size.
> 
> I would have to evaluate bsddialog’s auto-sizing to determine if it is
> trust-worthy given not only all the stored texts, but all the translations as
> well (as bsdconfig is i18n compatible).  It is actually less work to just
> allow bsdconfig to likely treat bsddialog as it is dialog and let it perform
                                             ^if
> the size calculations for you.
> 
> If bsddialog is top be a drop-in replacement, I’m more than a little
> surprised that it cannot accept the sizes calculated for dialog being passed
> to it.
> 
> 
> > 
> > Please note these considerations are only for bsdinstall, bsdconfig is
> > unchanged.
> > 
> 
> What of dpv?  bsdinstall uses dpv(3) to unpack the dists which in-turn relies
> on dlg_gauge_reallocate(3) from LGPL-dialog?
> — 
> Devin

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net