From owner-freebsd-bugs Fri Nov 22 1:30: 6 2002 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 6B3E637B404 for ; Fri, 22 Nov 2002 01:30:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C5AB143EAA for ; Fri, 22 Nov 2002 01:30:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gAM9U1x3049782 for ; Fri, 22 Nov 2002 01:30:01 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gAM9U1cU049781; Fri, 22 Nov 2002 01:30:01 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 11C8937B401 for ; Fri, 22 Nov 2002 01:22:26 -0800 (PST) Received: from kathmandu.sun.com (kathmandu.sun.com [192.18.98.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66AA743EA3 for ; Fri, 22 Nov 2002 01:22:25 -0800 (PST) (envelope-from kogoe@japan.sun.com) Received: from cedar.Japan.Sun.COM ([129.158.31.243]) by kathmandu.sun.com (8.9.3+Sun/8.9.3) with ESMTP id CAA28164 for ; Fri, 22 Nov 2002 02:22:24 -0700 (MST) Received: from vaio.Japan.Sun.COM (eslab203 [129.158.47.203]) by cedar.Japan.Sun.COM (8.10.2+Sun/8.10.2/ENSMAIL,v2.2) with ESMTP id gAM9MMx03858; Fri, 22 Nov 2002 18:22:22 +0900 (JST) Received: from vaio.Japan.Sun.COM (localhost [127.0.0.1]) by vaio.Japan.Sun.COM (8.12.6/8.12.6) with ESMTP id gAM9MMjR095650; Fri, 22 Nov 2002 18:22:22 +0900 (JST) (envelope-from kogoe@vaio.Japan.Sun.COM) Received: (from kogoe@localhost) by vaio.Japan.Sun.COM (8.12.6/8.12.6/Submit) id gAM9MMcw095649; Fri, 22 Nov 2002 18:22:22 +0900 (JST) Message-Id: <200211220922.gAM9MMcw095649@vaio.Japan.Sun.COM> Date: Fri, 22 Nov 2002 18:22:22 +0900 (JST) From: Hideo Kogoe Reply-To: Hideo Kogoe To: FreeBSD-gnats-submit@FreeBSD.org Cc: Hideo Kogoe X-Send-Pr-Version: 3.113 Subject: bin/45584: read builtin function of sh does not read standard input Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 45584 >Category: bin >Synopsis: read builtin function of sh does not read standard input >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 22 01:30:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Hideo Kogoe >Release: FreeBSD 4.7-RELEASE i386 >Organization: Sun Microsystems K.K. >Environment: System: FreeBSD vaio.Japan.Sun.COM 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Mon Nov 18 14:46:18 JST 2002 root@vaio.Japan.Sun.COM:/usr/src/sys/compile/VAIO i386 SONY VAIO PCG-R505R/GK running a customer kernel >Description: The read builtin function of /bin/sh does not read the standard input correctly. Refer to the How-To-Repeat section. >How-To-Repeat: $ echo Hello | read line; echo $line $ echo Hello | while read line; do echo $line; done Hello $ Just for reference, on Solaris, for example, $ echo Hello | read line; echo $line Hello $ echo Hello | while read line; do echo $line; done Hello $ Accroding to the specification of POSIX shell, the read function doesn't behave correctly. >Fix: Putting them into a sub-shell seems to work fine. $ echo Hello | (read line; echo $line) Hello $ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message