Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Nov 2016 22:49:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-sysinstall@FreeBSD.org
Subject:   [Bug 202058] bsdinstall - Disable dialog(3) for distfetch/checksum/distextract targets
Message-ID:  <bug-202058-2920-kWbkYVdAD5@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-202058-2920@https.bugs.freebsd.org/bugzilla/>
References:  <bug-202058-2920@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

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

--- Comment #7 from Devin Teske <dteske@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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-202058-2920-kWbkYVdAD5>