On 31/08/2022 02:31, наб wrote:
Package: coreutils
Version: 8.32-4+b1
Severity: normal
Dear Maintainer,
It appears drain/-drain is special, in that, unlike all operands,
it does /not/ prevent default output and it does /not/ exclude -a/-g:
-- >8 --
$ stty -drain
speed 38400 baud; line = 0;
-brkint -imaxbel
$ stty -drain -g
500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
$ stty -drain -a
speed 38400 baud; rows 54; columns 172; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc
-- >8 --
This is undocumented, and, indeed, directly against the usage string:
Usage: stty [-F DEVICE | --file=DEVICE] [SETTING]...
or: stty [-F DEVICE | --file=DEVICE] [-a|--all]
or: stty [-F DEVICE | --file=DEVICE] [-g|--save]
I assume this is an oversight.
Specifying [-]drain in isolation is an edge case,
but yes drain is treated specially to act like an option.
We originally considered a -I option to control this,
but changed to [-]drain for symmetry reasons,
to allow users to enable / disable explicitly.
I'll clarify this upstream with:
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index de819b6dc..2af761654 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -15518,6 +15518,8 @@ Tell the kernel that the terminal has @var{n} columns.
Non-POSIX.
@cindex nonblocking @command{stty} setting
Apply settings after first waiting for pending output to be transmitted.
This is enabled by default for GNU @command{stty}.
+Note this is treated as an option rather than a line setting,
+and will follow the option processing rules described in the summary above.
It is useful to disable this option
in cases where the system may be in a state where serial transmission
is not possible.
cheers,
Pádraig.