From nobody@FreeBSD.org  Tue Dec 14 20:16:04 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31C791065673
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Dec 2010 20:16:04 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 202DB8FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Dec 2010 20:16:04 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id oBEKG35v066398
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Dec 2010 20:16:03 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id oBEKG33V066397;
	Tue, 14 Dec 2010 20:16:03 GMT
	(envelope-from nobody)
Message-Id: <201012142016.oBEKG33V066397@red.freebsd.org>
Date: Tue, 14 Dec 2010 20:16:03 GMT
From: Jeff Wheelhouse <freebsd@wheelhouse.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: When watch is invoked incorrectly it trashes the tty
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         153156
>Category:       bin
>Synopsis:       When watch(1) is invoked incorrectly it trashes the tty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jilles
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 14 20:20:07 UTC 2010
>Closed-Date:    Sun Apr 06 19:40:03 UTC 2014
>Last-Modified:  Sun Apr 06 19:40:03 UTC 2014
>Originator:     Jeff Wheelhouse
>Release:        8.2-PRERELEASE
>Organization:
GridFury, LLC
>Environment:
FreeBSD h2 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Sat Dec 11 12:09:32 UTC 2010     root@h2:/usr/obj/usr/src/sys/CUSTOM  i386

>Description:

If watch is invoked incorrectly (without privileges) it exits with the appropriate diagnostic, but leaves the tty in an unusable state.  It prints "> " for every keypress.

This can be resolved by doing "stty sane </dev/pts/###" from another session.


>How-To-Repeat:


h2:jdw$ tty
/dev/pts/0
h2:jdw$ watch
watch: snp module not available: Operation not permitted
watch: fatal: cannot open snoop device
                                      h2:jdw$ > > > > > > > > 





>Fix:
Workaround:

h2:jdw$ tty
/dev/pts/8
h2:jdw$ stty sane </dev/pts/0
h2:jdw$ 

The proper fix is probably to call a cleanup function when exiting along this error path.



>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jilles 
State-Changed-When: Sun Apr 6 19:38:23 UTC 2014 
State-Changed-Why:  
This is a duplicate of PR bin/153052. 
Also, this is already fixed in stable/9 and newer. 


Responsible-Changed-From-To: freebsd-bugs->jilles 
Responsible-Changed-By: jilles 
Responsible-Changed-When: Sun Apr 6 19:38:23 UTC 2014 
Responsible-Changed-Why:  
Track replies. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=153156 
>Unformatted:
