From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 073FC1381F3 for ; Fri, 6 Sep 2013 20:10:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C906EE0C47; Fri, 6 Sep 2013 20:10:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 67668E0C47 for ; Fri, 6 Sep 2013 20:10:30 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 573BD33EB2A for ; Fri, 6 Sep 2013 20:10:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 067A7E468F for ; Fri, 6 Sep 2013 20:10:28 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1378498204.266cd3d17cdb8d3dacde171ac157c45f9fee3113.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/package/ebuild/doebuild.py X-VCS-Directories: pym/portage/package/ebuild/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 266cd3d17cdb8d3dacde171ac157c45f9fee3113 X-VCS-Branch: master Date: Fri, 6 Sep 2013 20:10:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5e14c8ac-704d-475c-8b9b-f55cb5eab79f X-Archives-Hash: cc4a5ccb5cbcae3c9422c88c2b3b4796 commit: 266cd3d17cdb8d3dacde171ac157c45f9fee3113 Author: Zac Medico gentoo org> AuthorDate: Fri Sep 6 20:10:04 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Sep 6 20:10:04 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=266cd3d1 Adjust pty permissions for userpriv. --- pym/portage/package/ebuild/doebuild.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 311f548..01707ae 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1488,6 +1488,25 @@ def spawn(mystring, mysettings, debug=False, free=False, droppriv=False, "groups": userpriv_groups, "umask": 0o02 }) + + # Adjust pty ownership so that subprocesses + # can directly access /dev/fd/{1,2}. + stdout_fd = fd_pipes.get(1) + if stdout_fd is not None: + try: + subprocess_tty = _os.ttyname(stdout_fd) + except OSError: + pass + else: + try: + parent_tty = _os.ttyname(sys.__stdout__.fileno()) + except OSError: + parent_tty = None + + if subprocess_tty != parent_tty: + _os.chown(subprocess_tty, + int(portage_uid), int(portage_gid)) + if "userpriv" in features and "userpriv" not in mysettings["PORTAGE_RESTRICT"].split() and secpass >= 2: # Since Python 3.4, getpwuid and getgrgid # require int type (no proxies).