From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 29 17:30:09 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B92416A4BF for ; Fri, 29 Aug 2003 17:30:09 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BBE0443FB1 for ; Fri, 29 Aug 2003 17:30:07 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h7U0U7Up085797 for ; Fri, 29 Aug 2003 17:30:07 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h7U0U76p085796; Fri, 29 Aug 2003 17:30:07 -0700 (PDT) Resent-Date: Fri, 29 Aug 2003 17:30:07 -0700 (PDT) Resent-Message-Id: <200308300030.h7U0U76p085796@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, Colin Percival Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08E8E16A4BF for ; Fri, 29 Aug 2003 17:29:03 -0700 (PDT) Received: from builder.daemonology.net (h24-87-233-42.vc.shawcable.net [24.87.233.42]) by mx1.FreeBSD.org (Postfix) with SMTP id D3C7743FE5 for ; Fri, 29 Aug 2003 17:29:01 -0700 (PDT) (envelope-from cperciva@beastie.daemonology.net) Received: (qmail 35845 invoked from network); 30 Aug 2003 00:28:01 -0000 Received: (for user qmaild) Received: from unknown (HELO beastie.daemonology.net) (127.0.0.1) by localhost with SMTP; 30 Aug 2003 00:28:01 -0000 Received: (qmail 84571 invoked by uid 0); 30 Aug 2003 00:07:42 -0000 Message-Id: <20030830000742.84570.qmail@beastie.daemonology.net> Date: 30 Aug 2003 00:07:42 -0000 From: Colin Percival To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/56166: /usr/bin/script exits prematurely if STDIN is closed X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Colin Percival List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Aug 2003 00:30:09 -0000 >Number: 56166 >Category: bin >Synopsis: /usr/bin/script exits prematurely if STDIN is closed >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 29 17:30:07 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Colin Percival >Release: FreeBSD 4.7-SECURITY i386 >Organization: >Environment: System: FreeBSD beastie.daemonology.net 4.7-SECURITY FreeBSD 4.7-SECURITY #0: Tue Aug 12 16:54:33 GMT 2003 root@builder.daemonology.net:/usr/obj/usr/src/sys/GENERICMP i386 >Description: If the standard input is closed, /usr/bin/script will exit immediately. This behaviour is sensible if script is being used interactively (to log a shell session) but not sensible otherwise (eg, if script is being used to log the output of a program). >How-To-Repeat: beastie# script -q /dev/null echo hello world hello world beastie# echo "hello world" | xargs script -q /dev/null echo beastie# >Fix: --- script.diff begins here --- --- usr.bin/script.c.orig Thu Jul 20 11:35:21 2000 +++ usr.bin/script.c Sat Aug 30 00:58:04 2003 @@ -170,7 +170,7 @@ n = select(master + 1, &rfd, 0, 0, tvp); if (n < 0 && errno != EINTR) break; - if (n > 0 && FD_ISSET(STDIN_FILENO, &rfd)) { + if (! argv[0] && n > 0 && FD_ISSET(STDIN_FILENO, &rfd)) { cc = read(STDIN_FILENO, ibuf, BUFSIZ); if (cc <= 0) break; --- script.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: