From owner-dev-commits-src-main@freebsd.org Sat Dec 26 15:00:03 2020 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 068DA4BB54D; Sat, 26 Dec 2020 15:00:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D36Rk6Zp2z3rjx; Sat, 26 Dec 2020 15:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4BEA16D98; Sat, 26 Dec 2020 15:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 0BQF02l3018638; Sat, 26 Dec 2020 15:00:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 0BQF02Xe018635; Sat, 26 Dec 2020 15:00:02 GMT (envelope-from git) Date: Sat, 26 Dec 2020 15:00:02 GMT Message-Id: <202012261500.0BQF02Xe018635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jilles Tjoelker Subject: git: ab41d7f371f5 - sh: Explain duplicate tcsetpgrp() calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jilles X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab41d7f371f52097ab0cb183565f1d8e7c122760 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for the main branch of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Dec 2020 15:00:03 -0000 The branch main has been updated by jilles: URL: https://cgit.FreeBSD.org/src/commit/?id=ab41d7f371f52097ab0cb183565f1d8e7c122760 commit ab41d7f371f52097ab0cb183565f1d8e7c122760 Author: Jilles Tjoelker AuthorDate: 2020-12-26 14:27:33 +0000 Commit: Jilles Tjoelker CommitDate: 2020-12-26 14:27:33 +0000 sh: Explain duplicate tcsetpgrp() calls This is a comment change only. --- bin/sh/jobs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index c46e526eab67..c0ba7d75e16d 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -928,7 +928,12 @@ forkshell(struct job *jp, union node *n, int mode) pgrp = jp->ps[0].pid; if (setpgid(0, pgrp) == 0 && mode == FORK_FG && ttyfd >= 0) { - /*** this causes superfluous TIOCSPGRPS ***/ + /* + * Each process in a pipeline must have the tty + * pgrp set before running its code. + * Only for pipelines of three or more processes + * could this be reduced to two calls. + */ if (tcsetpgrp(ttyfd, pgrp) < 0) error("tcsetpgrp failed, errno=%d", errno); }