misc/153156: When watch is invoked incorrectly it trashes the tty

Jeff Wheelhouse freebsd at wheelhouse.org
Tue Dec 14 20:20:08 UTC 2010

>Number:         153156
>Category:       misc
>Synopsis:       When watch is invoked incorrectly it trashes the tty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 14 20:20:07 UTC 2010
>Originator:     Jeff Wheelhouse
>Release:        8.2-PRERELEASE
GridFury, LLC
FreeBSD h2 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Sat Dec 11 12:09:32 UTC 2010     root at h2:/usr/obj/usr/src/sys/CUSTOM  i386


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.


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


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

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


More information about the freebsd-bugs mailing list