[Bug 202058] bsdinstall - Disable dialog(3) for distfetch/checksum/distextract targets

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 25 22:50:00 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202058

--- Comment #7 from Devin Teske <dteske at FreeBSD.org> ---
I recommend the following:

For C code, we should be using isatty(3) on stdout (fd=1) to determine whether
we use dialog(3) vs printf(3).

For shell code, we should be using stty(1) to determine whether we use
dialog(1) vs f_err()/printf(1).

It doesn't make sense to use dialog(1,3) when stdout is not a TTY, so the code
should dynamically detect this situation and adjust accordingly (no need for
setting a variable).

For distfetch, distextract, and cksum, your printf's are good-to-go, but the
conditional should be something like "if (notty)" which would be set when
isatty(3) tells us that fd=1 is not a TTY.

For bsdconfig, I would like to teach /usr/share/bsdconfig/dialog.subr to test
for TTY on include (e.g., ``stty >&- 2>&- || setvar $VAR_NOTTY 1''*) and if
set, dialog.subr would use f_err()/printf(1) instead of dialog(1). Then all the
other code could rely on f_dialog_* without having to address each invocation.

It would be rather slick if we allowed the environment to override the default
interpretation. That is to explain:

If fd=1 is not a TTY (in C) or stty(1) reports error (in sh), default to using
printf(1,3). An environment variable (I suggest $noTty, $VAR_NOTTY), if set and
non-NULL overrides the default setting. In fact, if set, don't even perform the
isatty(3)/stty(1) test.


* in /usr/share/bsdconfig/variable.subr we would add a "f_variable_new
VAR_NOTTY noTty"

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-sysinstall mailing list