[Bug 10001] New: command-line tcdrain utility needed
bugzilla at busybox.net
bugzilla at busybox.net
Fri Jun 30 00:47:07 UTC 2017
https://bugs.busybox.net/show_bug.cgi?id=10001
Bug ID: 10001
Summary: command-line tcdrain utility needed
Product: Busybox
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: philipp at redfish-solutions.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
In some of the environments where busybox is used a lot, you have things
happening like root pivots happening, the init process (pid 1) exec'ing its
replacement (especially during upgrades), etc.
It's not uncommon for some of these operations to lose output (1) if they are
scripted and (2) if they're running on a serial console and output is being
generated faster than the serial baudrate can move bits around.
For example, imagine a script which:
(1) generates a lengthy list of (say) files being preserved across an upgrade;
(2) kills all other processes but itself and init (perhaps including the sshd
which is the grandparent of this process);
(3) signals init to run (exec as a replacement) a process which pivots the
root, updates the filesystem, and reboots;
(actually, that's a good description of the revamped 'sysupgrade' in LEDE).
The problem is that when (1) happens, the sshd/bash that's the parent of the
script that's running, or the getty which is handling the login on a serial
port which isn't /dev/console (say /dev/ttyS1) might not finish draining output
before (2) happens as either disconnects the ssh session you're connected via
or the getty that was the parent of your login session resets your serial port
settings (including flushing buffers).
As a result, you don't get to see the output from (1) or the warnings from (2)
saying "killing all other processes".
What would be nice is having a wrapper for "tcdrain(3)" like:
tcdrain [device]
which opens "device" (or uses stdout, if "device" isn't specified) and does a
tcdrain() on it, then exits.
This would allow one to add an invocation to scripts like the above
not-so-hypothetical sysupgrade script.
It should be trivial, and I don't think it would add a lot of size to
busybox... and of course the feature could be turned off.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list