commit: 9d278330839049a818ba9f1e3985c7e502c63451 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> AuthorDate: Wed Aug 23 11:47:32 2023 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Thu Aug 24 18:23:41 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9d278330
lib/portage/gpg.py: send gpg output to stdout, then send stdout to /dev/null GnuPG removes the --output file on failure. Removing /dev/null breaks all kinds of things. Instead of telling GnuPG to output to /dev/null we output to stdout and then send the stdout to /dev/null, this avoids the problem where /dev/null is removed when the key fails to unlock. Bug: https://bugs.gentoo.org/912808 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org> Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> lib/portage/gpg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/gpg.py b/lib/portage/gpg.py index 6238ea6f7b..3067872244 100644 --- a/lib/portage/gpg.py +++ b/lib/portage/gpg.py @@ -35,7 +35,7 @@ class GPG: f"--homedir {self.signing_gpg_home} " f"--digest-algo {self.digest_algo} " f"--local-user {self.signing_gpg_key} " - "--output /dev/null /dev/null", + "--output - /dev/null", ) if "gpg-keepalive" in self.settings.features: @@ -61,7 +61,7 @@ class GPG: writemsg(f"{colorize('WARN', str(e))}\n") cmd = shlex_split(varexpand(self.GPG_unlock_command, mydict=self.settings)) - return_code = subprocess.Popen(cmd).wait() + return_code = subprocess.Popen(cmd, stdout=subprocess.DEVNULL).wait() if return_code == os.EX_OK: writemsg_stdout(f"{colorize('GOOD', 'unlocked')}\n")