From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6212D158089 for ; Fri, 8 Sep 2023 20:36:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 847E42BC026; Fri, 8 Sep 2023 20:36:08 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 698962BC026 for ; Fri, 8 Sep 2023 20:36:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 77158335C47 for ; Fri, 8 Sep 2023 20:36:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9F2D81143 for ; Fri, 8 Sep 2023 20:36:05 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1694205336.5d60ca35e66e241c092c8f42b2edf65789e51f28.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/gpkg.py X-VCS-Directories: lib/portage/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 5d60ca35e66e241c092c8f42b2edf65789e51f28 X-VCS-Branch: master Date: Fri, 8 Sep 2023 20:36:05 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 51d561fb-2594-4d31-8eb8-cab7155f4865 X-Archives-Hash: 79548e16a034b49a79675aaeecc82360 commit: 5d60ca35e66e241c092c8f42b2edf65789e51f28 Author: Sam James gentoo org> AuthorDate: Fri Sep 8 20:35:36 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Sep 8 20:35:36 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5d60ca35 gpkg: drop more dead code _drop_privileges was only called by the gentoo.org> lib/portage/gpkg.py | 69 ----------------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py index 4b94853e4c..d16dffbc27 100644 --- a/lib/portage/gpkg.py +++ b/lib/portage/gpkg.py @@ -142,29 +142,6 @@ class tar_stream_writer: def __exit__(self, exc_type, exc_value, traceback): self.close() - def _drop_privileges(self): - if self.uid: - try: - os.setuid(self.uid) - except PermissionError: - writemsg( - colorize( - "BAD", f"!!! Drop root privileges to user {self.uid} failed." - ) - ) - raise - - if self.gid: - try: - os.setgid(self.gid) - except PermissionError: - writemsg( - colorize( - "BAD", f"!!! Drop root privileges to group {self.gid} failed." - ) - ) - raise - def kill(self): """ kill external program if any error happened in python @@ -363,29 +340,6 @@ class tar_stream_reader: writemsg(colorize("BAD", f"GPKG subprocess failed: {self.cmd} \n")) raise CompressorOperationFailed("PIPE broken") - def _drop_privileges(self): - if self.uid: - try: - os.setuid(self.uid) - except PermissionError: - writemsg( - colorize( - "BAD", f"!!! Drop root privileges to user {self.uid} failed." - ) - ) - raise - - if self.gid: - try: - os.setgid(self.gid) - except PermissionError: - writemsg( - colorize( - "BAD", f"!!! Drop root privileges to group {self.gid} failed." - ) - ) - raise - def kill(self): """ kill external program if any error happened in python @@ -593,29 +547,6 @@ class checksum_helper: writemsg(colorize("BAD", f"!!!\n{self.gpg_result.decode()}")) raise InvalidSignature("GPG verify failed") - def _drop_privileges(self): - if self.uid: - try: - os.setuid(self.uid) - except PermissionError: - writemsg( - colorize( - "BAD", f"!!! Drop root privileges to user {self.uid} failed." - ) - ) - raise - - if self.gid: - try: - os.setgid(self.gid) - except PermissionError: - writemsg( - colorize( - "BAD", f"!!! Drop root privileges to group {self.gid} failed." - ) - ) - raise - def update(self, data): """ Write data to hash libs and GPG stdin.