From owner-svn-src-all@FreeBSD.ORG Sat Jun 18 23:58:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE8D2106566B; Sat, 18 Jun 2011 23:58:59 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4A678FC0A; Sat, 18 Jun 2011 23:58:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5INwxm7069335; Sat, 18 Jun 2011 23:58:59 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5INwxAF069331; Sat, 18 Jun 2011 23:58:59 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106182358.p5INwxAF069331@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 18 Jun 2011 23:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223282 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jun 2011 23:59:00 -0000 Author: jilles Date: Sat Jun 18 23:58:59 2011 New Revision: 223282 URL: http://svn.freebsd.org/changeset/base/223282 Log: sh: Remove special support for background simple commands. It expands the arguments in the parent shell process, which is incorrect. Modified: head/bin/sh/eval.c head/bin/sh/nodetypes head/bin/sh/parser.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sat Jun 18 23:43:28 2011 (r223281) +++ head/bin/sh/eval.c Sat Jun 18 23:58:59 2011 (r223282) @@ -894,14 +894,13 @@ evalcommand(union node *cmd, int flags, } /* Fork off a child process if necessary. */ - if (cmd->ncmd.backgnd - || ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN) + if (((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN) && ((flags & EV_EXIT) == 0 || have_traps())) || ((flags & EV_BACKCMD) != 0 && (cmdentry.cmdtype != CMDBUILTIN || !safe_builtin(cmdentry.u.index, argc, argv)))) { jp = makejob(cmd, 1); - mode = cmd->ncmd.backgnd; + mode = FORK_FG; if (flags & EV_BACKCMD) { mode = FORK_NOJOB; if (pipe(pip) < 0) @@ -1068,8 +1067,7 @@ parent: /* parent process gets here (if backcmd->fd = pip[0]; close(pip[1]); backcmd->jp = jp; - } else - exitstatus = 0; + } out: if (lastarg) Modified: head/bin/sh/nodetypes ============================================================================== --- head/bin/sh/nodetypes Sat Jun 18 23:43:28 2011 (r223281) +++ head/bin/sh/nodetypes Sat Jun 18 23:58:59 2011 (r223282) @@ -56,7 +56,6 @@ NSEMI nbinary # two commands separated NCMD ncmd # a simple command type int - backgnd int # set to run command in background args nodeptr # the arguments redirect nodeptr # list of file redirections Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sat Jun 18 23:43:28 2011 (r223281) +++ head/bin/sh/parser.c Sat Jun 18 23:58:59 2011 (r223282) @@ -240,8 +240,8 @@ list(int nlflag, int erflag) n2 = andor(); tok = readtoken(); if (tok == TBACKGND) { - if (n2->type == NCMD || n2->type == NPIPE) { - n2->ncmd.backgnd = 1; + if (n2->type == NPIPE) { + n2->npipe.backgnd = 1; } else if (n2->type == NREDIR) { n2->type = NBACKGND; } else { @@ -689,7 +689,6 @@ simplecmd(union node **rpp, union node * *rpp = NULL; n = (union node *)stalloc(sizeof (struct ncmd)); n->type = NCMD; - n->ncmd.backgnd = 0; n->ncmd.args = args; n->ncmd.redirect = redir; return n;