kern/141150: TIOCDRAIN ioctl on pts/pty master hangs
jh at sandstorm.net
Thu Dec 3 22:50:01 UTC 2009
>Synopsis: TIOCDRAIN ioctl on pts/pty master hangs
>Arrival-Date: Thu Dec 03 22:50:01 UTC 2009
>Originator: john hood
FreeBSD lister.sandstorm.net 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Tue Dec 1 20:49:34 EST 2009 jh at lister.sandstorm.net:/usr/src/sys/amd64/compile/NOCD amd64
our ancient 'gksu' port is broken-- it hangs after running the su/sudo command, and so output from the command never appears and gksu never exits.
the problem is twofold-- a bug in libgksu, which calls tcdrain() on the master side of a pty; and a bug in kernel, which hangs rather than returning an error on the tty ioctl.
see ports/141149 for a report + patch on libgksu.
I observe this on both 7.1 and 8.0.
8.0 kernel sleeps on ttyout when this happens.
In 8.0, ptsdev_ioctl() already seems to have some code to handle just this case, but it's only applied to the TIOCSETA[FW] ioctls used by tcsetattr(). So maybe it just needs to do this for TIOCFLUSH/TIOCDRAIN too.
In 7.1, something different happens, of course-- it looks like all these cases go through to the slave pty, and just TIOCSETA[FW] get a flush beforehand.
sudo pkg_add -r gksu
gdb gksu id
More information about the freebsd-bugs