From owner-svn-ports-all@freebsd.org Tue Jan 16 18:43:28 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B568EA6F2D; Tue, 16 Jan 2018 18:43:28 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4665A635DB; Tue, 16 Jan 2018 18:43:28 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6BA6C24465; Tue, 16 Jan 2018 18:43:27 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0GIhR4n010860; Tue, 16 Jan 2018 18:43:27 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0GIhRC2010859; Tue, 16 Jan 2018 18:43:27 GMT (envelope-from se@FreeBSD.org) Message-Id: <201801161843.w0GIhRC2010859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: Stefan Esser Date: Tue, 16 Jan 2018 18:43:27 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r459201 - head/ports-mgmt/portmaster/files X-SVN-Group: ports-head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/ports-mgmt/portmaster/files X-SVN-Commit-Revision: 459201 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2018 18:43:28 -0000 Author: se Date: Tue Jan 16 18:43:27 2018 New Revision: 459201 URL: https://svnweb.freebsd.org/changeset/ports/459201 Log: Test privileges early and complain if privileges are insufficient. The patch is based on ideas presented in the PR, but implemented differently. Re-open the PR, if this solution has unexpected side-effects or proves insufficient. PR: 174729 Reported by: ngie Approved by: antoine (implicit) Added: head/ports-mgmt/portmaster/files/ head/ports-mgmt/portmaster/files/patch-portmaster (contents, props changed) Added: head/ports-mgmt/portmaster/files/patch-portmaster ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/ports-mgmt/portmaster/files/patch-portmaster Tue Jan 16 18:43:27 2018 (r459201) @@ -0,0 +1,21 @@ +--- portmaster.orig 2018-01-14 21:53:23 UTC ++++ portmaster +@@ -45,7 +45,7 @@ if [ -z "$PM_PARENT_PID" ]; then + my_environment=`set` + + # If we are already root, unset this to avoid potential conflict +- [ `ps -o uid= $$` -eq 0 ] && unset PM_SU_CMD PM_SU_VERBOSE ++ [ `id -u` -eq 0 ] && unset PM_SU_CMD PM_SU_VERBOSE + fi + + #=============== Begin functions we always want to have =============== +@@ -3233,6 +3233,9 @@ if [ -n "$PM_FIRST_PASS" -a -z "$FETCH_ONLY" ]; then + elif [ -n "$FETCH_ONLY" -a -n "$PM_PACKAGES" ]; then + update_pm_nu $portdir + fi ++ ++# Test for necessary privileges to actually install ports ++[ "$($PM_SU_CMD id -u)" = 0 ] || fail "Insufficient privileges to install ports (run as root or set PM_SU_CMD)" + + # Do these things first time through + if [ -z "$PM_INDEX_ONLY" -a -z "$PM_BUILDING" -a -z "$SHOW_WORK" -a -z "$NO_ACTION" ]; then