From owner-freebsd-bugs@FreeBSD.ORG Sat Oct 26 14:40:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1EBD570B for ; Sat, 26 Oct 2013 14:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F17812105 for ; Sat, 26 Oct 2013 14:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r9QEe0TO066810 for ; Sat, 26 Oct 2013 14:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r9QEe0RM066809; Sat, 26 Oct 2013 14:40:00 GMT (envelope-from gnats) Resent-Date: Sat, 26 Oct 2013 14:40:00 GMT Resent-Message-Id: <201310261440.r9QEe0RM066809@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mats Erik Andersson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B60F84FC for ; Sat, 26 Oct 2013 14:33:37 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A431020E5 for ; Sat, 26 Oct 2013 14:33:37 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r9QEXb6Y096787 for ; Sat, 26 Oct 2013 14:33:37 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r9QEXbDW096784; Sat, 26 Oct 2013 14:33:37 GMT (envelope-from nobody) Message-Id: <201310261433.r9QEXbDW096784@oldred.freebsd.org> Date: Sat, 26 Oct 2013 14:33:37 GMT From: Mats Erik Andersson To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/183336: rsh: Blocking stdin and server X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2013 14:40:01 -0000 >Number: 183336 >Category: bin >Synopsis: rsh: Blocking stdin and server >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: Sat Oct 26 14:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Mats Erik Andersson >Release: 9.1-RELEASE >Organization: >Environment: 9.1-RELEASE-p7 i386 >Description: The client binary rsh(1) is reacting erroneously on SIGPIPE. This is present since legacy time. The problem is that rsh(1) will, except when called using the switch "-n", be using a forked child process. When the parent process receives a signal SIGPIPE this parent process will immediately abort, and will never send a shutdown signal to the child process. This situation typically arises when rsh(1) is part of a command line pipeline, where one member fails. >How-To-Repeat: The use cases $ rsh localhost cat /etc/motd | false $ rsh localhost date | true will leave a child process still running, and will in turn keep the server process running indefinitely and will also steal stdin from the login session. >Fix: The problem is that the legacy code never installs a signal handler for SIGPIPE in the function talk(), but only later kills the client process in main(). >From the fact that the default handler for SIGPIPE is process abortion, the whole problem arises. Since I personally resolved this issue in a GNU project based on BSD legacy code for rsh(1), I regretfully cannot produce a patch for the fear of poluting you code base away from its present license, but the above mechanism is the culprit of this annoying issue. >Release-Note: >Audit-Trail: >Unformatted: