From owner-freebsd-bugs Mon Jul 8 4:10:11 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 7958D37B400 for ; Mon, 8 Jul 2002 04:10:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E50DE43E09 for ; Mon, 8 Jul 2002 04:10:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g68BA3JU084610 for ; Mon, 8 Jul 2002 04:10:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g68BA3MG084609; Mon, 8 Jul 2002 04:10:03 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACB3337B400 for ; Mon, 8 Jul 2002 04:04:48 -0700 (PDT) Received: from rumori.com (client62-2-193-38.hispeed.ch [62.2.193.38]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A4BA43E42 for ; Mon, 8 Jul 2002 04:04:47 -0700 (PDT) (envelope-from willers@rumori.com) Received: (from willers@localhost) by rumori.com (8.11.6/8.11.6) id g68B4gR68945; Mon, 8 Jul 2002 13:04:42 +0200 (MEST) (envelope-from willers) Message-Id: <200207081104.g68B4gR68945@rumori.com> Date: Mon, 8 Jul 2002 13:04:42 +0200 (MEST) From: Moritz Willers Reply-To: Moritz Willers To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/40334: closing of file desriptors broken in /bin/sh 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: 40334 >Category: bin >Synopsis: closing of file desriptors broken in /bin/sh >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 08 04:10:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Moritz Willers >Release: FreeBSD 4.6-RELEASE-p1 i386 >Organization: >Environment: System: FreeBSD sand.wit.ch 4.6-RELEASE-p1 FreeBSD 4.6-RELEASE-p1 >Description: closing file desriptors via ">&-" in /bin/sh does not work. it seems the commits to redir.c going to 4.6 caused this. http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/sh/redir.c.diff?r1=1.12.2.1&r2=1.12.2.2 >How-To-Repeat: the below command should produce *no* output: # uname -r 4.6-RELEASE-p1 # /bin/sh -c 'echo "ha" >&-' ha # from the manpage: [n]>&- close stdout (or file descriptor n) >Fix: I did reinsert the close(fd); in line 148 in redir.c which fixed the problem, but I do not understand the code in redir.c really, so I have no idea about any side effects this could have. if (!try) { sv->renamed[fd] = i; + close(fd); } thanks - Moritz >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message