Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 May 2013 12:25:04 GMT
From:      Serhii Kharchenko <harry@advancedhosters.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/179048: watch(8) doesn't stop listening TTY when user releases it
Message-ID:  <201305281225.r4SCP4j8029976@oldred.FreeBSD.org>
Resent-Message-ID: <201305281230.r4SCU081030452@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         179048
>Category:       kern
>Synopsis:       watch(8) doesn't stop listening TTY when user releases it
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 28 12:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Serhii Kharchenko
>Release:        9.1-RELEASE-p1
>Organization:
AdvancedHosters
>Environment:
FreeBSD test-advancedhosters.com 9.1-RELEASE-p1 FreeBSD 9.1-RELEASE-p1 #1: Fri May 24 13:37:29 UTC 2013     root@test-advancedhosters.com:/usr/obj/usr/src/sys/Z-AMD64  amd64

>Description:
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

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305281225.r4SCP4j8029976>