Date: 30 Aug 2003 00:07:42 -0000 From: Colin Percival <cperciva@daemonology.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/56166: /usr/bin/script exits prematurely if STDIN is closed Message-ID: <20030830000742.84570.qmail@beastie.daemonology.net> Resent-Message-ID: <200308300030.h7U0U76p085796@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030830000742.84570.qmail>