Bug 179048 - watch(8) doesn't stop listening TTY when user releases it
Summary: watch(8) doesn't stop listening TTY when user releases it
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-28 13:30 UTC by Serhii Kharchenko
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serhii Kharchenko 2013-05-28 13:30:00 UTC
When watch(8) is listening TTY and user stops using this TTY (e.g. closes SSH connection) - watch proceeds listening it. It does not exit and does not write that the session is ended. 

The same problem is observed when security/termlog is used. termlog also uses snp(4) device and it also does not stop listening released TTY.

Looks that this problem appeared in FreeBSD-8 after pty(4) was replaced with pts(4) and snp(4) was completely rewritten.

How-To-Repeat: Just open 2 SSH sessions to the server:
Session #1:
root@test-advancedhosters:/root # tty
/dev/pts/0

Session #2:
root@test-advancedhosters:/root # watch /dev/pts/0
(and we see all the I/O of terminal /dev/pts/0)

After logout of session #1 we see just "logout" word and watch proceeds listening. TTY device is present and it is disappear only after watch is killed:
root@test-advancedhosters:/root # ps aux | grep watch | grep -v grep
root    45903   0.0  0.0 12288 1940  1  I+   12:11PM    0:00.00 watch /dev/pts/0
root@test-advancedhosters:/root # ls -la /dev/pts/0
crw-rw-rw-  1 root  wheel    0,  67 May 28 12:13 /dev/pts/0
root@test-advancedhosters:/root # kill 45903
root@test-advancedhosters:/root # ls -la /dev/pts/0
ls: /dev/pts/0: No such file or directory
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:41 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped