From owner-freebsd-bugs@FreeBSD.ORG Sat Nov 17 23:00:01 2012 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8FAEB430 for ; Sat, 17 Nov 2012 23:00:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 750768FC12 for ; Sat, 17 Nov 2012 23:00:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qAHN01t5074061 for ; Sat, 17 Nov 2012 23:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qAHN018V074058; Sat, 17 Nov 2012 23:00:01 GMT (envelope-from gnats) Date: Sat, 17 Nov 2012 23:00:01 GMT Message-Id: <201211172300.qAHN018V074058@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Jilles Tjoelker Subject: bin/173642: ``here-document'' does not works in FreeBSD 9 /bin/sh X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Jilles Tjoelker List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Nov 2012 23:00:01 -0000 The following reply was made to PR bin/173642; it has been noted by GNATS. From: Jilles Tjoelker To: bug-followup@FreeBSD.org, Aleksandr A Babaylov <"."@babolo.ru> Cc: Subject: bin/173642: ``here-document'' does not works in FreeBSD 9 /bin/sh Date: Sat, 17 Nov 2012 23:51:54 +0100 In PR bin/173642: > As of FreeBSD 9.0, the below script fails (with fdescfs mounted): > 5< foo > EOF > cat /dev/fd/5 This script took advantage of a bug in sh that has been fixed. A redirection should only apply for the duration of the command it is attached to, except if that command is the builtin "exec". This includes commands consisting solely of redirections (here-documents or other kinds). Before 9.0, sh did not handle this properly if the fd was not open before a redirection attached to some kinds of commands. Note that the script will not work even with the older sh if fd 5 is already open, for example sh your-script 5