/usr/bin/script echo lag
I routinely use the venerable Unix script command to log terminal
sessions, and Dyson's version has a misbehavior that I've never seen
on other Unix systems (I've been managing systems from the O/S family
since the early 1980s): namely, echo of typein is delayed until
several characters have accumulated (3 or 4 of them). In particular,
this bug makes it impossible to respond to interactive input, because
one can never be sure how input and output are synchronized.
% script Script started, file is typescript echo foo
As I type "echo foo", output is always 3 or 4 characters behind the input.
If I do the same typein in a normal Dyson xterm session, each character
is echoed as I type it.
The faulty behavior is the same whether the experiment is done with
the shell set to bash, ksh, or tcsh. The bug remains when I change
TERM from xterm to vt100 to vt52.
#3 Updated by Igor Pashev about 1 year ago
"script" is shipped in the "bsdutils" package built from util-linux. This package was built 5 years ago and did not set up pty properly. On illumos/solaris it is supposed to make few ioctl call, but did not, because libc was working in pre-xpg4 mode (?). Now the package is rebuilt, it finds new "libutil" library, and uses openpty() function from it. But more importantly, libc now work in xpg6 mode always and configures pty properly (openpty() from libutil ensures that).